On Wed, 2008-06-18 at 06:36 +0200, Karoly Negyesi wrote:
> >  (a) I would *never* want to use an implementation of closures like that.
> >  (b) Closures as proposed are *far* better than not having closures.
> 
> Could you elaborate on a) ?

I dislike the habit of implicit declaration --- strongly --- and the
consequent need for the lexical keyword (although at this point PHP's
stuck with it).  I can see myself forgetting to use lexical far more
often than accidentally leaving off a `my' in Perl I should have used (I
hardly ever shadow variable names anyway, so if I forget `my' is usually
a use strict 'vars' error).

I dislike curly braces.  Syntax that extends as far to the right as
possible tends to end up with fewer delimiters and a cleaner appearance.
It's basically a way to replace a bunch of closing braces with a
single ) or (in Haskell, implicit) ;

lintPat p0 $ \ ty0 -> lintPat p1 $ \ ty1 -> lint e

vs

lintPat($p0, sub { my ($ty0) = @_; lintPat($p1, sub { my ($ty1) = @_;
lint($e) })})

Four closing delimiters seems excessive.

Nit: `function' is verbose.  ML uses fun or fn (I forget which and am
too lazy to google).  Perl's regular keyword is sub, so they use that.

There are worse fates than duck typing (C++ comes to mind :), and given
a language with neither lexical closures/anonymous functions nor HM
typing, I'd complain about the lack of lambdas first.  But, still, no HM
means no type classes.  That ultimately becomes limiting.  (I still
haven't seen a decent implementation of monads in a dynamically typed
language).  But PHP is probably pretty much stuck with it.

Not to criticize, mind you --- the proposal looks excellent for what it
does.  But I like what Haskell does worlds better.

jcc


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to