[nem-en] [RFC] type parens

Michal Moskal malekith at pld-linux.org
Fri Sep 24 20:23:09 CEST 2004


On Fri, Sep 24, 2004 at 02:47:21PM +0100, Daniel James wrote:
> Michal Moskal wrote:
> 
> >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.
> 
> I think this is a really good idea. In case your interested, this issue
> was recently discussed on the C++ newsgroups, some ideas for alternative
> syntaxes were:
> 
> Hashtable!(int, string) - this is what the D programming language uses.
> Hashtable.<int, string>
> Hashtable<|int, string|>
> 
> And there were plenty of others along similar lines. I like the first
> one, but I don't think it'd be right for your purposes since !( and .<
> can already appear in Nemerle. Maybe something along the lines of:
> 
> Hashtable![int, string]
> 
> would be good, so it would be obvious that it isn't an array index. But,
> if you don't like this, I think plain square brackets are fine.

There is no syntactic way to distinguish between a type and an expression
-- the `foo' can be both, no matter what we do. So I guess there is
little reason to use the `!'. However, even if the stupid part of the
parser is not going to distinguish places in which types can occur,
people easily can. This is mostly on the right side of the `:'.

> Also, on a historical note, it turns out that there was some opposition 
> to the syntax in 1992. And hindsight suggests that it was a mistake for 
> the C++ standars committee to ignore it. For details see:
> 
> http://groups.google.com/groups?selm=chkira%24peq%241%40news1nwk.SFbay.Sun.COM

Nice to see it. There are number of C++ oddities that affected rest of
us... 

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e>+++ b++
: ::: Logic is a nice contrast to the Real World. :: UL++++$ C++ E--- a?




More information about the devel-en mailing list