On Monday, January 12, 2015 at 2:09:54 PM UTC-5, James Crist wrote:
>
> #1 probably is for the best, but I'm wondering what the community response 
> is to this? I come from a heavy Python background, and without namespaces, 
> I'm not sure how to handle function name-clashing best.
>

Alternatively, Julia has namespaces; I'm not sure why you think it doesn't.

Any definitions that you put inside "module Foo .... end" are in the Foo 
namespace.  If you "import Foo", you have to do Foo.foo() to access them. 
 (Even if you do "using Foo", you still need Foo.foo for symbols that were 
not explicitly exported by the module.)

So, it is perfectly possible to have a function Foo.zero(x) that is 
completely distinct from (does not extend) Base.zero(x).    This is 
probably the right choice if your Foo.zero function does something 
conceptually different than Base.zero.

That being said, the Julian style function is to only use the Base names 
for functions that are conceptually similar to the Base function.   If your 
function is conceptually different from Base.zero(x), then it would be more 
idiomatic to give it a different name.

--SGJ

Reply via email to