-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for modules #1
Comments
One one to solve the problem with including a module twice would be to add an A function returning the directory for the current file:thisDir = #(define-scheme-function (parser location)()
(dirname input-file-name)) A function to expand a filename:This is a bit more tricky: expandPath = #(define-scheme-function (parser location package)(string?)
(cond ((char=? (string-ref f 0) #\/) f)
((string=? (substring f 0 2) "~/")
(let ((prefix (passwd:dir (getpwuid (geteuid)))))
(string-append prefix (substring f 1 (string-length f)))))
((char=? (string-ref f 0) #\~)
(let* ((user-end (string-index f #\/))
(user (substring f 1 user-end))
(prefix (passwd:dir (getpwnam user))))
(string-append prefix (substring f user-end (string-length f)))))
(else (string-append (getcwd) "/" f)))) The above function doesn't handle "." or "..". |
Since this kind of feature is probably going to be used only by openlilylib, and since @uliska is not yet decided how to proceed forward with refactoring the openlilylib code, I'm closing this. |
I didn't previously notice this "issue" could be related to openlilylib, so I only now looked into it. But yes, I think it makes sense to implement such functionality in openLilyLib itself. The user will then use \require "some-openlilylib-package" % optionally with a version
% This will implicitly load oll-core
\useModule "some-openlilylib-package.some-module"
% oll-core will handle to resolving of the path to the module
% This does make sense as oll-core also provides the posibility
% of passing options to modules With regard to your |
In order to support more complex packages (like for example openlilylib), introduce support for sub-package modules:
In that case, instead of loading
openlilylib@0.3.1/package.ly
, lypack will loadopenlilylib@0.3.1/control_points.ly
A possible problem is a case where you have a package which
package.ly
file includes all its files. Requiring the package in the normal way, and later requiring a specific file of the package in either a user's file or another dependency, will lead to the same file being included twice.The text was updated successfully, but these errors were encountered: