No household is perfect

Walter Bright newshound2 at digitalmars.com
Wed Dec 4 09:07:22 PST 2013


On 12/4/2013 7:27 AM, H. S. Teoh wrote:
> Of course, it's not the *point* of DSLs to be distinct from the host
> language, but it's a good idea for it to be. Operator overloading that
> turns + and * into something completely unlike their usual meanings
> violates the principle of least surprise. A CTFE-string containing + and
> * interpreted differently is better, because the syntax itself reminds
> you that something unlike normal D syntax is happening.
>
> 	// (D) It's clear * and + means something different:
> 	auto m = input.match(ctRegex!`^a+b*c`);
>
> 	// (C++) What on earth might this mean?!
> 	sregex r = (s1= +_w) >> ' ' >> (s2= +_w) >> '!';

Looks like we're on the same wavelength here.



More information about the Digitalmars-d mailing list