Pop3 connection with D

kris foo at bar.com
Thu Mar 8 16:19:43 PST 2007


Andrei Alexandrescu (See Website For Email) wrote:
> 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

sounds good.

Yet, you appear to be describing a "black-box" of sorts, with diagnostic 
exceptions? My guess is that interactive "step through" debugging, with 
something like MSVC6 for example, would not be particularly feasible?



More information about the Digitalmars-d mailing list