On Thu, 2007-05-24 at 15:27 +0000, Martin Percossi wrote: > Hello felix-list, > > I think it would be a good idea to try to shamelessly steal syntax ideas > from haskell.
hehe .. already being done :) > I think that haskell's syntax, and typeclasses, are its > best features -- and you've already got the latter! And some of the former .. recognize this: println$ 1,2; meaning println (1,2); The $ is stolen from Haskell .. :) > For example, one of the sexiest features of haskell is composition of > functions. Using the notation "def" to denote function definition: > def foo = f · g > Since the "." character is sensibly used for field access, I would > propose the use of "·" for composition. That looks like the same character.. I can see it is higher, but only just. I have investigated using . for composition anyhow. At present it doesn't quite work. But don't forget: operators in Felix are overloaded, and f . g has a unique meaning when f,g are functions: functions don't have fields, so there's no ambiguity. However, it doesn't work at the moment because the translation is at the wrong time (in fact the above has been implemented for some time, but the field access notation overrides it ;( > Another cool thing: the use of backquotes to get infix notation. 5 `mod` > 2 is just very nice in my opinion. Actually it sucks because backquotes can't be nested without gratuitous brackets: 5 `f . g` 6 is fine, but you'd probably need: 5 `f `(g . h`) k` or `() to handle nesting. Other suggestions are 5 <: f . g :> 6 Note this is not just 'infixing' a named function, the function can be an expression. > Also: operator overloading is very > cool, and in particular, sections, as in: squares = map (^ 2). That's not possible if you have prefix operators too, since ^ could be prefix. Some operators like +, - can be both infix and prefix. Note also, Felix uses tuples rather than curried form, they're more efficient (in Felix) because they're easier to analyse than closure chains. However, in Felix all operators correspond to a named function, for example + corresponds to 'add' The real problem with 'map (+2)' is that you'd have to eta expand the tuple form. > Another thing that's very cool about haskell: the whitespace thing. Optional indentation has just been implemented, but it requires an introduction: whilst x do $$ x = 1 y = 2 This integrates fairly seamlessly with free form, without any special knowledge of the syntax. I'm not sure I like the $$ symbol though .. it's a bit ugly. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language