a more consistent const syntax
Robert Fraser
fraserofthenight at gmail.com
Mon Aug 6 13:50:13 PDT 2007
Chris Nicholson-Sauls Wrote:
> > Yes, there seem to be a lot of people not being very happy with the
> > current const syntax.
> > But I have not seen much concrete suggestion how to make it better.
> >
>
> Its a tough nut to crack. Chances are we really need to just do
> something crazy and new... its the coming-up-with-something-new part
> that's hard.
>
> A 'func(T...)(A...)(R)' function syntax, though. Now that's new. :)
>
> -- Chris Nicholson-Sauls
It's not that it's a bad idea, but there's some inner aversion to it in me. [Return type] [name] [args] has been a staple of C-based languages (and, indeed, strongly-typed languages in general).
Personally, I like the const semantics except:
- Compile time constants should be "invariant" only.
invariant int x = 3;
const int y = 3;
Both x and y are compile-time constants...
- Class invarinats should be better disambiguated. Personally, I like the idea of "readonly" replacing cost and "const" replacing invariant, with invariant reserved for class invarinats (thus keeping some degree of backwards compatibility).
More information about the Digitalmars-d
mailing list