Skip to content
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

In io module, automatically evaluate module_file on given path #92

Open
mschubert opened this issue Mar 3, 2018 · 2 comments
Open

In io module, automatically evaluate module_file on given path #92

mschubert opened this issue Mar 3, 2018 · 2 comments

Comments

@mschubert
Copy link
Owner

This would make sure that read/write is always relative to the script the call resides in.

Any downsides?

@klmr
Copy link
Contributor

klmr commented Mar 12, 2018

The downside is that you sometimes want to use files relative to PWD. In fact, I’d guess that this is the most common use-case for data files, definitely always with user-provided files. Consider:

sys = mod::use(klmr/sys)

sys$run({ 
    io = mod::use(ebits/io)
    args = sys$cmd$parse(arg('file', 'input file'))
    sys$printf('%s', summary(io$read_table(args$file)))
})

@mschubert
Copy link
Owner Author

mschubert commented Mar 12, 2018

NB: this issue is probably 2 years old, I just copied them from the other repository and they will need to be cleaned up further. We didn't have a sys module back then.

And yes, this is true for command-line interfaces, but usually not for modules providing API access to data. But you're right, the better way to simplify module-relative file access is probably https://github.com/klmr/modules/issues/132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants