Re: [gtk-list] define-enum carries duplicate nice names



On Sat, 6 Dec 1997, Tim Janik wrote:

> hi all,
> 
> while implementing the new gluecode generator, i just came
> accross the following problem.
> on parsing enum definitions i encountered that quite a lot of
> the enum value "nice_name"s used for scheme code are duplicates e.g.:
> 
> (define-enum GtkTroughType gtk
>   (none GTK_TROUGH_NONE)
>   (start GTK_TROUGH_START)
>   (end GTK_TROUGH_END))
> 
> (define-enum GtkPackType gtk
>   (start GTK_PACK_START)
>   (end GTK_PACK_END))
> 
> here, `start' and `end' are identical. i know that for scheme code
> it is sufficient to have uniqueness of the enum value names only within
> specific types, but does this apply to all possible applications for
> enum value nice names?

For Perl, this isn't a problem (at least in the implementation I used. In
others, it might be a problem).

However, if we add a bit more information:

 (define-enum GtkPackType gtk pack
   (start GTK_PACK_START)
   (end GTK_PACK_END))

then it will be easy for a program to use 'start', 'pack_start', or
'gtk_pack_start', as needed.

> also numeric characters in the first position of identifiers could
> cause problems with languages other than scheme, as in:
> 
> (define-enum GdkEventType gdk
>   (nothing GDK_NOTHING)
>   .
>   .
>   (2button-press GDK_2BUTTON_PRESS)
>   (3button-press GDK_3BUTTON_PRESS)
>   .
>   .
>   (other-event GDK_OTHER_EVENT))
> 
> with a few lines extra codes i managed to still scan these identifiers
> besides ordinary numbers, but again, shouldn't we behave a little bit
> more resctrictive to honour every possible use (and languages besides
> scheme)?

Yes, I agree, all identifiers should start with [A-Za-z] for widest
compatibility.

-- 
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]