www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - macro keyword taken?

reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
So I wanted to make myself a template called "macro", but it turns out
it's a keyword:

template macro()
{
}

test.d(7): TemplateIdentifier expected following template
test.d(7): Declaration expected, not 'macro'

Is there something planned with this keyword?
Aug 07 2011
next sibling parent reply Robert Clipsham <robert octarineparrot.com> writes:
On 07/08/2011 23:59, Andrej Mitrovic wrote:
 So I wanted to make myself a template called "macro", but it turns out
 it's a keyword:

 template macro()
 {
 }

 test.d(7): TemplateIdentifier expected following template
 test.d(7): Declaration expected, not 'macro'

 Is there something planned with this keyword?

It was originally going to be used in D2 for AST macros, however it was found that string mixins (an already existing feature) were already as powerful as the proposed AST macros. As such, the keyword is reserved for future use, possibly in D3 once the details have been reconsidered. There's a video lying around somewhere of Walter presenting what would have been macros somewhere if you're interested. -- Robert http://octarineparrot.com/
Aug 07 2011
parent =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <xtzgzorex gmail.com> writes:
On 08-08-2011 01:07, Robert Clipsham wrote:
 On 07/08/2011 23:59, Andrej Mitrovic wrote:
 So I wanted to make myself a template called "macro", but it turns out
 it's a keyword:

 template macro()
 {
 }

 test.d(7): TemplateIdentifier expected following template
 test.d(7): Declaration expected, not 'macro'

 Is there something planned with this keyword?

It was originally going to be used in D2 for AST macros, however it was found that string mixins (an already existing feature) were already as powerful as the proposed AST macros. As such, the keyword is reserved for future use, possibly in D3 once the details have been reconsidered. There's a video lying around somewhere of Walter presenting what would have been macros somewhere if you're interested.

Would you happen to have a link? My Google-fu seems to be weak today. - Alex
Aug 08 2011
prev sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I think he means the "The Future of D" videos found here:
http://prowiki.org/wiki4d/wiki.cgi?Videos

What I'm wondering about is whether something like this is still
planned though. I don't mind the keyword being taken that much.
Aug 08 2011
parent bearophile <bearophileHUGS lycos.com> writes:
Andrej Mitrovic:

 What I'm wondering about is whether something like this is still
 planned though. I don't mind the keyword being taken that much.

Like "goto" keyword in Java :o) Bye, bearophile
Aug 08 2011