new DIP5: Properties 2

Bill Baxter wbaxter at gmail.com
Tue Jul 28 11:41:14 PDT 2009


On Tue, Jul 28, 2009 at 11:12 AM, bearophile<bearophileHUGS at lycos.com> wrote:
> Bill Baxter:
>> Now we may not want to go so hog wild putting @this and @that
>> everywhere, but if we did we could get rid of 19 keywords right there,
>> and add @property also without adding a new keyword.
>
> Glad to see I'm not the only one to think like this :-)
> Later more semantic attributes can be added, for example to express things that the compiler can use to parallelize code better, to know about pointer aliasing, to tell the compiler what asm functions can be inlined (currently done with a pragma in LDC), etc.
>
> What syntax do you want to use when you want more than one attribute?
> @something1 @somethingelse
> ...

I don't know.  I'm actually not too up on how these things are used in
the languages where they exist (just Java, Python, and C#?).  It just
seems like a good idea to solve a more general problem if possible.
And when someone reminded us that "deprecated" is a keyword, that set
me off.


Something else that occurred to me while reading the keyword list is
that "switch" is a horrible keyword hog.  Three keywords just for that
one construct!   If D didn't have a switch statement today and were
looking to add one, somehow I doubt that there would be sufficient
support for dedicating three whole keywords to the thing.    Switch is
a monstrosity pretty much any way you look at it.  Sh had the right
idea there.  Is "case" really necessary there?  Some syntax should
suffice I would thing.  And "default" is probably the world's most
useless keyword.  Why not "else:" or "*:" instead of introducing a
whole new keyword?

--bb



More information about the Digitalmars-d mailing list