RFC: std.uuid

Johannes Pfau spam at example.com
Fri Dec 23 00:40:28 PST 2011


Andrei Alexandrescu wrote:

> On 12/22/11 5:38 PM, Vladimir Panteleev wrote:
>> Using 3rd-party technology such as source preprocessors makes future
>> contributions more difficult for the vast majority. Considering that the
>> language provides nearly the same thing as a fully-supported feature

I must be missing something. Your talking of mixins? Ragel is not a 
macro/mixin system, it's a state machine compiler, compiling a 20 line 
machine definition into 700 line fast, goto based code? Or are you talking 
about the new regex? I seriously doubt that any regex implementation can 
compare with ragel generated code in terms of performance. (Not important 
for the uuid id parser, but if you ever want to implement a fast http 
server...)

>> it seems like a redundant complication. Parsing/formatting HTTP headers
>> isn't exactly rocket-science, either.

Nope, but it gets exhausting if you write all parsers by hand (and it's more 
probable that you introduce bugs). Mongrel (ruby http server) uses ragel, 
lighttpd2 (small, fast webserver) does as well. Also how can writing a state 
machine definition which looks exactly like the BNF in the spec be more 
difficult than writing a parser manually?


> Agreed. I think it would be wonderful to achieve ragel capabilities with
> compile-time execution. If we need ragel in D we've failed.
> 
> Andrei

I agree that a state machine compiler in D using ctfe would be awesome, but 
currently there is none. If ragel based code isn't acceptable for phobos at 
all, I'll just  rewrite the uuid parsers using for, switch and to!ubyte.


More information about the Digitalmars-d mailing list