On 7/14/14, 12:29 PM, Dicebot wrote:
On Monday, 14 July 2014 at 15:13:21 UTC, Timon Gehr wrote:
On 07/14/2014 11:55 AM, Dicebot wrote:
I must admit D is far from perfect in that regard because operator
overloading is still not limited enough

There is no real point in limiting it at all. It is just a matter of
naming your functions properly.

auto subtract(int a, int b){ return a+b; }

Same principle of surprise minimization. Reader expects arbitrary
actions done by function call. Reader expects arithmetical semantics
from arithmetical operations. I don't see "you can change anything"
language working for any large team production.

Macros are not "you can change anything". Macros generate code based on AST nodes. No surprise at all. You read the comments on what the macro does (or look at the code) and that's it.

Making macros look like regular function calls, that you might not like. For me, it makes the code more readable. Instead of this:

class Foo
  mixin(property :foo)
end

Or this:

class Foo
  property!(:foo)
end

You simple write this:

class Foo
  property :foo
end

And it's super clear to everyone what this does (again: or read the docs or check the source code to see what this does).

What kind of "macros that change anything" you have in mind?

Reply via email to