Re: Suggestions for ESL (was: Euphoria Standard Library on UBoard)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Dave Probert wrote:

> As far as a naming convention for enum stuff goes, whatever is chosen
> should reflect what the task is related to.
>
> next() is very vague as far as a function name goes,

Generally speaking, I agree. However I find it tempting to be able to
write code like (quoting Tommy):
constant
    DAY_OF_WEEK = enum(),        -- define the enum DAY_OF_WEEK
    MONDAY  = next(DAY_OF_WEEK), -- MONDAY is the next DAY_OF_WEEK value
    TUESDAY = next(DAY_OF_WEEK), -- TUESDAY is the next DAY_OF_WEEK value
...


> whereas enum_next() would make more sense.

But
constant
    DAY_OF_WEEK = enum(),        -- define the enum DAY_OF_WEEK
    MONDAY  = enum_next(DAY_OF_WEEK),
    TUESDAY = enum_next(DAY_OF_WEEK),
...

doesn't read so nice.

How about the following:
constant
    DAY_OF_WEEK = the_enum(),        -- define the enum DAY_OF_WEEK
    MONDAY  = the_next(DAY_OF_WEEK), -- MONDAY is the next DAY_OF_WEEK value
    TUESDAY = the_next(DAY_OF_WEEK), -- TUESDAY is the next DAY_OF_WEEK value
...


It still reads nice, and because both functions start with 'the_', it's
(more or less) obvious that they belong together. Or is that too crazy?

<snip>

Just an idea,
   Juergen

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu