February 07, 2006
Sebastián E. Peyrott wrote:
>>> I'm not sure how I managed to get your attention, but it's been an exciting thing to be involved with.
>> It's because you and Eric offered a kick-ass response to those C++ people who denigrate D's templates as "not capable of metaprogramming." You and Eric have shown that D templates enable much more powerful uses than C++ ones do, and look a lot better to boot. The regex example blew my socks off, and I wanted to showcase it. That meant fixing D's templates so regex didn't need all those ugly workarounds.
> 
> This might be a bit OT, but where may I find those examples?
> 
> --Sebastián.

The "meta" package that Walter is referring to I believe lives at the DDL project on dsource.org. Somebody correct me if I'm wrong.
February 07, 2006
Yay!


"Walter Bright" <newshound@digitalmars.com> wrote in message news:dsapit$2mfo$3@digitaldaemon.com...
>
> "Charles" <noone@nowhere.com> wrote in message news:dsag9h$2cm8$1@digitaldaemon.com...
> >> I'd say hold off on designing a template library without implicit function template instantiation.
> >
> > That scentence is a little tricky for me, does that mean IFTI is
expected
> > for 1.0 ?
>
> Yes.
>
>


February 07, 2006
In article <dsb5vt$2o2$1@digitaldaemon.com>, Kyle Furlong says...
>
>Sebastián E. Peyrott wrote:
>>>> I'm not sure how I managed to get your attention, but it's been an exciting thing to be involved with.
>>> It's because you and Eric offered a kick-ass response to those C++ people who denigrate D's templates as "not capable of metaprogramming." You and Eric have shown that D templates enable much more powerful uses than C++ ones do, and look a lot better to boot. The regex example blew my socks off, and I wanted to showcase it. That meant fixing D's templates so regex didn't need all those ugly workarounds.
>> 
>> This might be a bit OT, but where may I find those examples?
>> 
>> --Sebastián.
>
>The "meta" package that Walter is referring to I believe lives at the DDL project on dsource.org. Somebody correct me if I'm wrong.

Yes, that is correct:

http://trac.dsource.org/projects/ddl/browser/trunk/meta/regex.d

As Walter mentioned, there is much that he's improved with the compiler that obviates the need for some sillyness in the code.  I don't know when I'll get around to improving it, but it's BSD licensed after all.  Go nuts!

- Eric Anderton at yahoo
February 08, 2006
Walter Bright wrote:
> "Don Clugston" <dac@nospam.com.au> wrote in message news:dsa0p5$1tl7$1@digitaldaemon.com...
>> Fantastic! In that case, I withdraw all other proposals I've made regarding templates. The meta-programming template support seems to be really quite solid now, from my original list of workarounds, the only one that remains is
>> digitalmars.com digitalmars.D.bugs:6004
>> which I think you just missed, because you fixed the almost identical one digitalmars.com digitalmars.D.bugs:6003.
> 
> The one about (a[x]) template arguments? That one turns out to be not so easy to solve, which is why I deferred it. The workaround (putting redundant parentheses around it) is ugly, but not onerous.

Indeed. It's just a mild imperfection. Wow, it's really hard to guess what's difficult to implement and what isn't. That one sounded really easy, whereas I guessed that the static if scoping issue was an intrinsic limitation of the parser.

>> Now, almost everything I try works as I'd hoped (and I've tried some pretty wild stuff!). It tends to be unforgiving, in that some kinds of syntax errors segfault the compiler instead of giving error messages; but that does not prevent library development. It's possible to write really elegant metafunctions now.
> 
> I still want any bug reports that produce seg faults.
> 
>> I'm not sure how I managed to get your attention, but it's been an exciting thing to be involved with.
> 
> It's because you and Eric offered a kick-ass response to those C++ people who denigrate D's templates as "not capable of metaprogramming." You and Eric have shown that D templates enable much more powerful uses than C++ ones do, and look a lot better to boot. 

<g> C++ metaprogramming using partial template specialisation has always felt like drawing with a crayon. With static if, it's so easy.
I found a C++ implementation of a compile-time PI calculation, extremely clever but hilariously unreadable. And I bet it took fifty times longer to write than mine did.

The regex example blew my socks off,
> and I wanted to showcase it. That meant fixing D's templates so regex didn't need all those ugly workarounds.

Time for that to move from proof-of-concept to some serious code, I think. If I only had some time...
February 08, 2006
In article <dscv6f$1kks$1@digitaldaemon.com>, Don Clugston says...
>
>The regex example blew my socks off,
>> and I wanted to showcase it. That meant fixing D's templates so regex didn't need all those ugly workarounds.
>
>Time for that to move from proof-of-concept to some serious code, I think. If I only had some time...

Same here.

- Eric Anderton at yahoo
February 08, 2006
pragma wrote:
> In article <dsb5vt$2o2$1@digitaldaemon.com>, Kyle Furlong says...
>> Sebastián E. Peyrott wrote:
>>>>> I'm not sure how I managed to get your attention, but it's been an exciting thing to be involved with.
>>>> It's because you and Eric offered a kick-ass response to those C++ people who denigrate D's templates as "not capable of metaprogramming." You and Eric have shown that D templates enable much more powerful uses than C++ ones do, and look a lot better to boot. The regex example blew my socks off, and I wanted to showcase it. That meant fixing D's templates so regex didn't need all those ugly workarounds.
>>> This might be a bit OT, but where may I find those examples?
>>>
>>> --Sebastián.
>> The "meta" package that Walter is referring to I believe lives at the DDL project on dsource.org. Somebody correct me if I'm wrong.
> 
> Yes, that is correct:
> 
> http://trac.dsource.org/projects/ddl/browser/trunk/meta/regex.d
> 
> As Walter mentioned, there is much that he's improved with the compiler that
> obviates the need for some sillyness in the code.  I don't know when I'll get
> around to improving it, but it's BSD licensed after all.  Go nuts!
> 
> - Eric Anderton at yahoo

Just out of curiosity, I wanted to run the regex example:
	auto exp = &regexMatch!("[a-z]*\s*\w*");
	writefln("matches: %s",exp("hello    world");
However the compilation fails with these errors:
        main.d(65): undefined escape sequence \s
        main.d(65): undefined escape sequence \w
	...
What's going on?

-- 
Bruno Medeiros - CS/E student
"Certain aspects of D are a pathway to many abilities some consider to be... unnatural."
February 08, 2006
Bruno Medeiros wrote:
> pragma wrote:
>> In article <dsb5vt$2o2$1@digitaldaemon.com>, Kyle Furlong says...
>>> Sebastián E. Peyrott wrote:
>>>>>> I'm not sure how I managed to get your attention, but it's been an exciting thing to be involved with.
>>>>> It's because you and Eric offered a kick-ass response to those C++ people who denigrate D's templates as "not capable of metaprogramming." You and Eric have shown that D templates enable much more powerful uses than C++ ones do, and look a lot better to boot. The regex example blew my socks off, and I wanted to showcase it. That meant fixing D's templates so regex didn't need all those ugly workarounds.
>>>> This might be a bit OT, but where may I find those examples?
>>>>
>>>> --Sebastián.
>>> The "meta" package that Walter is referring to I believe lives at the DDL project on dsource.org. Somebody correct me if I'm wrong.
>>
>> Yes, that is correct:
>>
>> http://trac.dsource.org/projects/ddl/browser/trunk/meta/regex.d
>>
>> As Walter mentioned, there is much that he's improved with the compiler that
>> obviates the need for some sillyness in the code.  I don't know when I'll get
>> around to improving it, but it's BSD licensed after all.  Go nuts!
>>
>> - Eric Anderton at yahoo
> 
> Just out of curiosity, I wanted to run the regex example:
>     auto exp = &regexMatch!("[a-z]*\s*\w*");
>     writefln("matches: %s",exp("hello    world");
> However the compilation fails with these errors:
>         main.d(65): undefined escape sequence \s
>         main.d(65): undefined escape sequence \w
>     ...
> What's going on?

Try making it a wysiwyg string or doubling up the backslashes.


Sean
February 08, 2006
Sean Kelly wrote:
> Bruno Medeiros wrote:
>> pragma wrote:
>>
>> Just out of curiosity, I wanted to run the regex example:
>>     auto exp = &regexMatch!("[a-z]*\s*\w*");
>>     writefln("matches: %s",exp("hello    world");
>> However the compilation fails with these errors:
>>         main.d(65): undefined escape sequence \s
>>         main.d(65): undefined escape sequence \w
>>     ...
>> What's going on?
> 
> Try making it a wysiwyg string or doubling up the backslashes.
> 
> 
> Sean

Duh, silly me. Interesting though, didn't know D didn't accept undefined escape sequences. Seems good idea.

-- 
Bruno Medeiros - CS/E student
"Certain aspects of D are a pathway to many abilities some consider to be... unnatural."
February 08, 2006
"Don Clugston" <dac@nospam.com.au> wrote in message news:dscv6f$1kks$1@digitaldaemon.com...
> Walter Bright wrote:
>> The one about (a[x]) template arguments? That one turns out to be not so easy to solve, which is why I deferred it. The workaround (putting redundant parentheses around it) is ugly, but not onerous.
> Indeed. It's just a mild imperfection. Wow, it's really hard to guess what's difficult to implement and what isn't. That one sounded really easy, whereas I guessed that the static if scoping issue was an intrinsic limitation of the parser.

The trouble is that a[x] could be a type, or it could be an expression. Right now, it assumes it's a type, so it fails to match with a template expression parameter.

> <g> C++ metaprogramming using partial template specialisation has always
> felt like drawing with a crayon. With static if, it's so easy.
> I found a C++ implementation of a compile-time PI calculation, extremely
> clever but hilariously unreadable. And I bet it took fifty times longer to
> write than mine did.

I'd really like a pointer to that, to use as a comparison. Such side-by-side comparisons really drive the point home, and so are very valuable.

> The regex example blew my socks off,
>> and I wanted to showcase it. That meant fixing D's templates so regex didn't need all those ugly workarounds.
> Time for that to move from proof-of-concept to some serious code, I think. If I only had some time...

Don't we all <g>. It'd be great to have it in place before SDWest, because then there'll be a surge of very influential people looking at it.


February 08, 2006
"Bruno Medeiros" <daiphoenixNO@SPAMlycos.com> wrote in message news:dsde2h$21n6$1@digitaldaemon.com...
> Duh, silly me. Interesting though, didn't know D didn't accept undefined escape sequences. Seems good idea.

Accepting undefined escape sequences would shut the door on supporting any new escape sequences in the future.