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
Ruby generator: Use 'require_relative' instead of 'require'. #344
Ruby generator: Use 'require_relative' instead of 'require'. #344
Conversation
Hmm, I'm not sure that
IMHO at least, requiring that the user set up their include/load paths to match their file hierarchy is not an eminently unreasonable thing (i.e., reasonable people could disagree, but it doesn't seem obviously wrong to me). FWIW, the C++ generator does a similar thing by translating imports to Thoughts? |
I think it's non-idiomatic Ruby to assume that Ruby's So even in C, willy-nilly includes of In Ruby it's a common pattern to add a project's Regarding locations, I found the behaviour of |
OK, a few things:
Not quite; in C++, |
One suggestion that came to mind: perhaps we could add a flag that places all output files in the root of the output directory, regardless of input path? This matches the default behavior of, e.g., |
I'm going to close this because there's been no activity for a few years, but feel free to reopen it if this is still a problem. |
This fixes the (bad) assumption that the currently evaluated module's parent directory is in
$LOADPATH
and thatrequire
thus would be able to resolve dependencies.Note that I'm not familiar enough with this project to know if
file->dependency(n)
actually always returns a relative path. If it does, this will not work, but I can amend the patch if that's necessary.