DIP 50 - AST macros
Walter Bright
newshound2 at digitalmars.com
Thu Nov 14 13:12:11 PST 2013
On 11/14/2013 11:40 AM, deadalnix wrote:
> This is not proposing to configure syntax.
Right, it is about inserting arbitrarily different meaning into existing syntax.
For example, I have a friend from the middle east who worked at Microsoft. His
english was excellent. But sometimes he'd get tripped up - for example, he'd
take his idea to his boss, who'd discuss it, and then say:
"fine"
He took that to mean "my boss approves of my great idea!" Unfortunately, "fine"
has undergone a meaning reversal colloquially, and actually means "your idea
sux". This wound up getting him into trouble. There were a few other phrases
like this with unintentionally hilarious misunderstandings.
(Also, a popular way of encrypting communications is to have private meanings
for phrases like "my cat ate my homework" meaning "initiate Operation X".)
Now, let's take the AST macros, and pass it "4+3". Apparently is a feature that
the macro can transform this to produce "hello" as the result. The result is
that although the language looks the same, there is no "anchor" a person can
rely on to indicate the meaning. The meaning of "fine" is reversed, so to speak.
The riposte is, of course, every feature can be abused and good programmers
won't do that. Unfortunately, it's IN THE VERY NATURE of macros to be abusive,
and even the very best programmers can and will take it to the limit. They will
see and decry the abuse in everyone else's code but their own, which they will
justify. As I said, I see this over and over again.
On the other hand, with string mixins, it is immediately obvious that one is
dealing with different syntax, and so expect something different to happen.
More information about the Digitalmars-d
mailing list