So now all I'd like in Erlang is...

Joachim Durchholz <>
Sat Feb 21 03:30:47 CET 2004


Richard Carlsson wrote:
> On Fri, 20 Feb 2004, Joachim Durchholz wrote:
> 
>> The reference to Fact is compiled into code that says: "retrieve 
>> whatever is assigned to the name 'Fact'; crash if Fact is either 
>> unassigned or assigned something other than a fun; evaluate
>> parameters and run the fun with them."
> 
> So you want dynamic binding, like in certain Lisp dialects?

This depends on what you mean with "dynamic binding".
If you mean what I used to call "dynamic scoping", then, no, I don't
want this. I want static scoping: as soon as the "Fact" inside the
function's body is bound to a value, it should stick with that binding
for the rest of its lifetime.

But you're right that the rules have to be worded carefully to make this
case clear, and I was a bit sloppy here.

> The problem with that is of course that if someone passes such a fun
> into some other context where Fact is bound to something completely
> different (like an integer), it dies horribly.

Agreed - dynamic scoping is dangerous. Some people advocate its use for
some specific, limited circumstances (I don't, but that's just my taste
*g*).

Regards,
Jo
--
Currently looking for a new job.




More information about the erlang-questions mailing list