Pop3 connection with D

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Thu Mar 8 16:47:44 PST 2007


kris wrote:
> 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?

Stepping through was of course possible and useful. The main difference 
was that stepping through manually-written code was replaced by stepping 
through the more compact templated code. The instantiation types are 
different and therefore different actual binary code maps to the same 
source line.

Andrei



More information about the Digitalmars-d mailing list