Pop3 connection with D
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Thu Mar 8 16:09:15 PST 2007
kris wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> kris wrote:
>>
>>> Andrei Alexandrescu (See Website For Email) wrote:
>>>
>>>> Possibly implementing protocols could be an area in which DSLs might
>>>> help, e.g. in the guise of automata and of course regex. I once
>>>> designed a little DSL for implementing FTP and it was of great help.
>>>
>>>
>>>
>>> Compile-time DSLs?
>>
>>
>> Obviously.
>
> That sounds reasonably sophisticated.
>
> Just out of interest, how does one easily debug something like that?
Very easy. The FTP protocol is described as a collection of states with
prescribed transitions in between them. A DFA (in C++) implemented them
in a compact manner; whenever the DFA would bail out (by throwing), it
would tell what state it was in, what was the expected input, and what
the actual input was. I remember that library was a rewrite of a library
written in a "old school" style from first principles (e.g. int and if
and switch), meaning that following what the code does and where you are
was horrendous. We were very pleased with the rewrite.
Andrei
More information about the Digitalmars-d
mailing list