[nem-en] [RFC] type parens
Michal Moskal
malekith at pld-linux.org
Fri Sep 24 11:06:35 CEST 2004
Hello,
After the variant-dot there is another issue we would like your
comments about.
We are going to change our parser, so it first parses the program at the
very low level -- just pairing the parens and splitting things at the
commas and semicolons. Then a term rewriting system would be applied to
get some higher level structure. This would give us uniform syntax at
the low level (which is desirable), but still highly extensible, even
more then it is now.
Now there is a problem with Hashtable<int,string> kind of things, since
the <> operators are used both as parens and common operators. There is
no easy way to distinguish between f(x < foo, y > bar) and x<foo,y>.
This depends on the context, and depending on the contexts would defeat
the purpose of the two level parser.
We also know it is causing problems in syntax highlighting modes.
So, there is proposition to change <> to []. So it would be now
Hashtable[int,string], list[foo] and so on.
We don't feel very good about it -- it will break backward as well as
C# compatibility, but this seems the only right thing to do. We already
changed this once from the () parens, and converting the sources
required lots of perl magic. We are going to provide similar perl magic
with the 0.3 target release for this feature. It would work in most
cases probably.
There are also some other ideas -- write Hashtable<int string> or
Hashtable<int><string>, Hashtable<<int,string>> but they are not as
consistent, at least for me.
--
: Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e>+++ b++
: When in doubt, use brute force. -- Ken Thompson :: UL++++$ C++ E--- a?
More information about the devel-en
mailing list