On Thu, Nov 7, 2013 at 2:27 AM, Jacob Carlborg <doob@me.com> wrote:
On 2013-11-06 23:48, Timothee Cour wrote:

As I mentioned in my OT, this is what I already have implemented ("I've
actually already implemented this feature via a mixin, and find it
extremely useful, but ... "); and I did take care of proper escaping,
etc. I am using it extensively, however the requirement for using a
mixin makes things uglier than they should:

* cryptic ctfe error msgs upon wrong variable names
* mixin can't be used in UFCS chains; additional () nesting
to the point that I only use it in cases where the alternative is uglier.
* potentially more strain on ctfe
* mixins in general should be used sparingly

Sure we can use existing mixins to fill this need, but to me this is
exactly the same as the situation with lambda literal syntax:

a=>a*2
instead of
(a){return a*2;}

or lazy parameters:
void fun(lazy string a)
vs:
void fun(string delegate() a)

A little of syntax sugar can provide huge benifits.
It's use case would apply to all assert error messages, DSLs etc.

I agree with you, but I rather have a more general solution. That is, AST macros.


I would love to have AST macros too, but how do they help for the problem at hand? (eg use cases in OT + DSL). Like others mentioned, the feature is not crazy, it is present in most languages.


 
--
/Jacob Carlborg