Boost logo

Boost :

From: Loïc Joly (loic.actarus.joly_at_[hidden])
Date: 2005-05-17 15:01:55


Paul Mensonides a écrit :

>Hi Loïc.
>
>Okay, I have a little more time now.
>
>
>
Thank you for your help, it helps me clarify some fuzzy points.

>>I'm trying to use the boost preprocessor library to allow the
>>user to define "rich" enums, for instance enums that cannot
>>be converted to int, whose values can be displayed in human
>>readable form on a stream...
>>
>>
>
>You might already know that there are several fancy enum implementations around.
>However, I'm not sure if any them fit what you're looking for. Specifically,
>enumerators that cannot be converted to integers. What you want, AFAICT, is a
>set of symbols only that share a common type. You may want to look for existing
>implementations first.
>
>
I do this for a personnal project, part of which is to improve my
skills, so even if I crave for re-use, not this time. By the way, I had
a little check, and no fancy enum I have seen seems to have reached a
wide acceptance yet, or to cover my requirements. Maybe I will call my
system yafe (yet another fancy enum) :).

[snip example]

>In other words, the importance of debuggability greatly depends on what you're
>generating--i.e. what you want the preprocessor to write for you. If it is
>something complex, particularly if it can fail inside the specific generated
>code, then debuggability is more important.
>
>
>>And now, the questions :
>>Which writing do you think would be best ? Why ? Are there
>>other possibilities I overlooked ? Is is possible to have a
>>syntax like 1/ and 2/ with good debugability ?
>>
>>
>
>To the last, yes. But the point at which it is debugged is different. Instead,
>when you write something like the above, you debug the preprocessor metaprogram
>to make sure it is generating what you want, and then you debug the *pattern*
>that it is generating by creating instances of the pattern (like color above),
>and making sure that it works correctly. Once that is done, you shouldn't have
>to debug it again.
>
Ok, I think I can see your point. I guess that my reluctance was due to
the fact that since I am not fluent in cpp, I was afraid to create a
macro that would span on many lines. Let's go for this syntax then.
Maybe I will publish the result in the mailing list files area, if I
think "yafe" can be of interrest to other people.

Regards,

-- 
Loïc

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk