Tue, 16 Feb 2010 21:08:19 +0100, grauzone wrote: > You're discussing here about syntax proposals to make string mixins > better readable. IMHO they should stay as ugly as they are to discourage > using them. (Although Andrei is already fearless enough to use advertise > string mixins as a standard way to overcome the still-too-ugly syntax > and bad compiler optimizer support for passing delegates; the > std.algorithm documentation still passes functions as string, and his > book will probably too.) > > Before discussing syntax improvements, you really should solve some > basic problems of string mixins: for example, solve the issue that > string mixins may be compiled in a completely foreign environment, as > opposed to the environment where the user wrote them. (When I understand > correctly, this is the "hygienic" aspect of LISP macros.) > > My favorite example is still this: > > void helper(int x) { /+ whatever here is +/ return x; } > map!"helper(a)+1"(range) > > Also, why should the "function" passed by the user be able to access the > internals of std.algorithm?
Agreed, lambdas should be used instead of string macros in some cases. > > Building the function with a string is not that bad (seriously ugly but > works). What I've seen from early macro proposals didn't sound that > great either. But what's really needed is solving the symbol lookup > problems above. D macros were supposed to be hygienic, solving this > particular problem. > > Actually, I wouldn't be too surprised if one day, Walter announced that > D won't get macros, because they tried to figure out how they should > work and came to the conclusion that macros suck. That's how things work > in D Land, right? My guess is that macros are getting there eventually, but atm D design team lacks manpower and D2 release is too soon so they can't really introduce a half-broken macro system now.