Re: Future features of Euphoria?

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

Adriann wrote about enumerated type:
>Try this:
>
>global type weekday(sequence s)
>        return find(s, {"Monday","Tuesday","Wednesday","Thursday"
>                      "Friday","Saturday","Sunday"})
>end type        -- weekday
>

Well Adriann the point is that you can't index a sequence with it.
As a pascal programmer I understand what Carlos meant by enumerated type.

In euphoria it could be something like this:

enum <identifier>
  <tags list>
end enum

where identifier name this particular set
      tags list enumerate the members of the set.

example:

enum week_days
  Sunday,Monday,Thuesday,Wednesday,Thursday, Friday,Saterday
end enum

the system would type check enum as it does for other types

Then we could use those enum to index a sequence, for example

 sequence ToDo  -- a to do list.


 Todo[Monday] = {"by a new car","kill the cat"," any thing else"}


You can't do that with your type weekday

as Todo["Monday"] would be a syntax error

Jacques Deschenes
Baie-Comeau, Quebec
Canada
desja at quebectel.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu