On Saturday, December 27, 2014 5:15:38 PM UTC-5, Stefan Karpinski wrote:
>
> You shouldn't be using include here – the way to do this is to make sure 
> that moduleFile.jl is in your LOAD_PATH and then do `using moduleFile` or 
> `import moduleFile`.
>

I've complained before that "include" in user code is an anti-pattern, and 
I guess I'm going to complain about it again.

Are there examples of other languages that people admire where the 
equivalent of "include" is regularly used in user code?

The main place that I think I've seen people use something like it is PHP, 
and even there, I think "require" is used more frequently in good code.

Languages I've used where include-like functionality is very rarely used 
include Python (include->execfile), Java, and node-style Javascript 
(include->exec(fs.readFileSync("filename"))).

I don't think there's much to learn from Matlab here, and Mathematica's 
culture of user created libraries seems weaker than in many other 
environments.

Do people frequently use source() in R?

Reply via email to