Browse thread
Custom operators in the revised syntax
- Nicolas Pouillard
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Nicolas Pouillard <nicolas.pouillard@g...> |
| Subject: | Custom operators in the revised syntax |
Hello, Again this message is about the revised syntax and it's negative points or useless distances with the original one. Today it's about custom operators. In the original syntax everyone knows that's easy to define and use custom operators like ++, -->, >>>, +|, =?=, ... and as many as you want. To declare them in the original syntax one needs parens: let ( =?= ) x y = ...;; In the revised syntax one use a backslash: value \=?= x y = ...; Why not... but in the revised syntax these new operators are not automatically infix or prefix or postfix, you have to make your own syntax extension. In practice I found it too heavy, unless you already have a custom syntax extension local to the project or something like that. However there is bad things with parens: - Not LL(1) when treating them in parsing - Spaces must be used for the `*' character to avoids starting comments. In fact when dealing them in the lexer that's ok. And the space issue is not too big. Concerning the fixity of these operators I've already changed it to have the same thing as the original syntax. Concerning the backslash, I want to restore the parens convention to declare them and then free the backslash character and make it available in the default lexer (useful for an ascii lambda for instance). As before, feel free to make comments on that (not really passionating) subject. Regards, -- Nicolas Pouillard