> It actually sounds a lot like pattern guards, since you're suggesting this > sugar could be applied to any sort of object? So your desugarer would > allow a function like > > islong :: [a] -> Bool > islong {length = l} = l > 10
this looks like a hack that only works for one-argument functions, and its only purpose seems to hide the argument. I don't like the (local) looks of "length = 1" anyway. Compare to "length [] = 0". You'd think the first one is a typing error until you spot the surrounding "{ .. }" While we're at it, I'd like to mention a feature that I'd love to have in a record system (for a long time): defaults, resp. initializer functions. E. g. data Foo = Foo { foo :: Int, bar :: Int ; bar x = 2 * foo x } Something like that (imagine that (*) is some expensive computation). Note that default declarations in classes are vaguely similar. Again, the concrete syntax problem is whether to hide the argument. Perhaps data Foo = Foo { foo :: Int, bar :: Int ; bar = 2 * foo self } with a reserved word "self" is better. - Are there semantic problems? It might even be desirable to hide the "computed" component, i. e. Foo { foo = 5, bar = 7 } could be forbidden. And still better: if we could say later (i. e. outside the definition of Foo) that the values of bar should be "memorized" in the Foo records. Of course this might be hard for separate compilation (if type definition and memorized functions are in different modules. Again, this is vaguely similar to orphan instances.) Best regards, -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- ---- http://www.imn.htwk-leipzig.de/~waldmann/ ------- _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell