Le dimanche 16 novembre 2014 à 15:40 -0800, Justas _ a écrit :
> I totally agree that it is good to pass variable M to compute(). But
> to do that, I need to pass M to computeSomething(), which does not use
> M at all, and then pass it down to compute. I think it is the best to
> use Type and pass it as a holder of M and param.
> 
I'm not sure what you mean in your last sentence, but I think it's good
practice to pass M to computeSomething() and then to compute(), so that
it's clear what variables affect the behavior of these functions. If you
don't respect this hierarchical organization, you quickly end up not
knowing which global variables affect which code, and everything becomes
very confusing.

> Also I tried this
> 
>   export foo
>   function foo(f)
>     function bar(b)
>       return b * 2
>     end
> 
> 
>     return f
>   end
> 
> 
> 
> 
> 
> and I could not access bar(). Is this snippet correct?
>From where did you try to access it?


Regards

Reply via email to