November 15, 2013
Am 14.11.2013 21:54, schrieb Walter Bright:
> (A lot of the C++ macro abuse looks like normal syntax to the user, but it
> behaves in a way that the casual user would find completely unexpected.

same can be said about Boost Spirit templates

November 15, 2013
On 2013-11-14 21:54, Walter Bright wrote:

> If it is powerful enough to do async/await but look like normal D
> syntax, then is going to suffer from these faults.

I don't think so. The idea is to have it look consistent within the language. Take a look at __traits. It looks just like a function call, but it's far from being a function call. Classes and structs look very similar, only the keyword is different, but they are very different.

-- 
/Jacob Carlborg
November 17, 2013
On Thursday, 14 November 2013 at 22:06:06 UTC, deadalnix wrote:
>
> mymacro(4+3); // <= can be "hello"
> myfunction(4+3); // <= can be "hello as well"
>
> Quite frankly, this isn't really convincing.
>

True but you will hardly use myfunction as an extension to the language.

If I understand the issues, I quite understand Walter's reluctance to add such a feature. Once you add it, you add the capability to change the language, or to create an entirely new language. If you let it, no matter how loud you cry, people *will* abuse the feature, and they will do it from day one. The C++ templates experiment shows what happens when you do that. We don't want to repeat the same mistakes.

Basically, people want to change the language, but without having to discuss their own extensions in the newsgroups. It's sometimes handy, but you'll end up with crappy features all over the place.
November 17, 2013
On Thursday, 14 November 2013 at 19:42:36 UTC, Zsombor Barna wrote:
>
> D's syntax remains the same ( statements, expressions, function calling, numbers etc. ). These AST manipulation tools just define new words or language constructs. Human languages tend to be altered as times passes and the needs change. That's why new words appear. Even the grammar is not the same as the one my grandparents used.

Which shows all the problems raised by Walter:
1. you need an entry in the dictionary that you need to look up for each new word that someone has introduced,
2. with natural language, you don't need to know its *exact* semantics when you use a new word, while in programming it is mandatory,
3. you *don't* want your programming language to arbitrarily change over time. That's probably the biggest issue.
November 17, 2013
On 11/14/2013 11:38 PM, Jacob Carlborg wrote:
> On 2013-11-14 21:54, Walter Bright wrote:
>
>> If it is powerful enough to do async/await but look like normal D
>> syntax, then is going to suffer from these faults.
>
> I don't think so. The idea is to have it look consistent within the language.
> Take a look at __traits. It looks just like a function call, but it's far from
> being a function call. Classes and structs look very similar, only the keyword
> is different, but they are very different.
>

Think about the desired feature mentioned earlier in this thread of being able to insert a "return;" statement, causing what looks like a function call to return from the caller.

That's a major step increase in obfuscation, not just a detail.
November 17, 2013
On 11/14/2013 1:34 PM, H. S. Teoh wrote:
> What if macros adopted an overtly different syntax?

That would be better, but I don't think enough better.
November 17, 2013
On 11/14/2013 2:06 PM, deadalnix wrote:
> You can't argue that string mixin is good while AST macro is bad.

True, but you also cannot argue that since D has string mixins it must also have AST macros.

What macros do is bless, encourage, and make inevitable a particularly abusive style of programming. D already has super powerful metaprogramming abilities that we are far from exploring the limits of. I don't think we should be adding on even more that experience has shown goes quickly out of control.
November 17, 2013
On Sunday, 17 November 2013 at 09:13:04 UTC, Walter Bright wrote:
> On 11/14/2013 2:06 PM, deadalnix wrote:
>> You can't argue that string mixin is good while AST macro is bad.
>
> True, but you also cannot argue that since D has string mixins it must also have AST macros.
>
> What macros do is bless, encourage, and make inevitable a particularly abusive style of programming. D already has super powerful metaprogramming abilities that we are far from exploring the limits of. I don't think we should be adding on even more that experience has shown goes quickly out of control.

Yeah, you are right, but I doubt anybody would use macros in production code without considering much less powerful constructs of the language to solve the problem. In hobby projects, I don't mind if create spaghetti code while experimenting.
November 17, 2013
On 2013-11-17 09:58, Walter Bright wrote:

> Think about the desired feature mentioned earlier in this thread of
> being able to insert a "return;" statement, causing what looks like a
> function call to return from the caller.

I'm not entirely sure what you're saying. Could you please post a link to the post mentioning this or show an example.

> That's a major step increase in obfuscation, not just a detail.

-- 
/Jacob Carlborg
November 17, 2013
On 2013-11-17 10:00, Walter Bright wrote:

> That would be better, but I don't think enough better.

Then why to we have UDA's with the same syntax as language attributes and why do we have operator overloading.

You can hide arbitrary code behind operator overloading.

-- 
/Jacob Carlborg