Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
read_file
macro method #6967Add
read_file
macro method #6967Changes from 10 commits
91c8a3f
9200e38
0f801d7
2f378a3
82fe311
0820ae8
f13cccb
a2d70e4
9aa5f09
29adc35
2ae9e53
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
./some_file.txt
should work, can you try it out? The idea is that this works like require.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, it probably works. But I don't think it should. Relative paths should be relative to the current working directory.
Either way, there should be a spec for reading a relative path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we don't do require
"#{__DIR__}/..."
, we use relative paths.require
can be thought as a macro call that requires the given file.read_file
is another macro that works the same way but reads it at compile-time. Because it's compile-time, I think it makes sense to use the same rules as require. In fact, the whole change that @Sija made because of me requesting it is exactly that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument to
require
is always an (explicit) string literal. There is no reason to make it customizeable. And there is no reason to require a file relative to the working directory.But to
read_file
you might want to pass aStringLiteral
as argument that is originally defined in a completely different place. And it there are perfectly fine reasons to read a file relative to the current working directory instead of the source location.So I don't think
require
andread_file
should share the same path resolution.