> *This Haskell fan’s contender is “dynamic typing” :P
Nothing is impossible!
> *This Haskell fan’s contender is “dynamic typing” :P
Nothing is impossible!
You can find defenders of dynamic typing, but dynamic scope is now widely seen as a mistake. Or at least dynamic scope by default; it has specialised uses--and in Haskell the Reader Monad is basically isomorphic to dynamic scoping and no one complains about it.
Right you are. Even more horrible. The tcl language still has it!
Perl's the only non-lisp I'm aware of that does dynamic binding well-enough to get the idea, but too many things just don't work:
local *int = sub { return 69 }; print int("42");
is a particularly annoying one: You just can't do it. Other names might have better chances, e.g. package foo; sub int { 42 };
package main; sub a{local *foo::int = sub { return 69 };&b(@_);} sub b{goto \&foo::int};
print b("x"), a("x"), b("x"), a("x");
but this is a little unsatisfying.Well, Haskell does dynamic binding in the form of the Reader Monad. It's well received there.
But yeah, by that standard, Haskell implements both dynamic scoping and mutable state via getters and setters. (Though, of course, you can go all out on these via lenses.)
And yes, dynamic scopes can be useful in specific cases. What's wrong is having your variables scoped dynamically by default.
And they are all much more enticing than the things deserve.
'Idiot' and 'retard' didn't start out as pejorative either.