1. Enum?

I do this all the time and I know others do because I see in it code everywhere.
Here are some examples, some of which you will recognize:

constant FILE_NO = 1,           -- file number
	 LINE_NO = 2,           -- local line number
	 FILE_PTR = 3,          -- open file number 
	 FILE_START_SYM = 4,    -- symbol before start of file
	 OP_WARNING = 5,        -- save/restore with/without options
	 OP_TRACE = 6,          
	 OP_TYPE_CHECK = 7,
	 OP_PROFILE_TIME = 8,
	 OP_PROFILE_STATEMENT = 9,
         OP_DEFINES = 10        -- ifdef defines

global constant GET_SUCCESS = 0,
		GET_EOF = -1,
		GET_FAIL = 1,
		GET_NOTHING = -2

global constant 
	D_NAME = 1,
	D_ATTRIBUTES = 2,
	D_SIZE = 3,
	D_YEAR = 4,
	D_MONTH = 5,
	D_DAY = 6,
	D_HOUR = 7,
	D_MINUTE = 8,
	D_SECOND = 9


Etc... This is fine, but what if you want to add a new element and not at the
end? I am sure we've all done it. Well, I borrowed a good thing from other
languages called an enum (enumeration)... I've done the code already but have not
committed. What do you think?

global enum D_NAME, D_ATTRIBUTES, D_SIZE, ...
global enum PERSON_NAME, PERSON_AGE=5, PERSON_DOB, PERSON_EMAIL

printf(1, "name=%d, attributes=%d, size=%d\n", {
    D_NAME, D_ATTRIBUTES, D_SIZE})
printf(1, "person_name=%d, age=%d, dob=%d, email=%d\n", {
    PERSON_NAME, PERSON_AGE, PERSON_DOB, PERSON_EMAIL})

-- name=1, attributes=2, size=3
-- person_name=1, age=5, dob=6, email=7


An enum is not a new type, it emits a constant. They can be local or global. I
think it has a lot of benefit but wanted to get community input.

--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » topic index » view message » categorize

2. Re: Enum?

Jeremy Cowgar wrote:
> Etc... This is fine, but what if you want to add a new element and not at the
> end? I am sure we've all done it. Well, I borrowed a good thing from other
> languages
> called an enum (enumeration)... I've done the code already but have not
> committed.
> What do you think?
> 
> }}}
<eucode>
> global enum D_NAME, D_ATTRIBUTES, D_SIZE, ...
> global enum PERSON_NAME, PERSON_AGE=5, PERSON_DOB, PERSON_EMAIL
> 
> printf(1, "name=%d, attributes=%d, size=%d\n", {
>     D_NAME, D_ATTRIBUTES, D_SIZE})
> printf(1, "person_name=%d, age=%d, dob=%d, email=%d\n", {
>     PERSON_NAME, PERSON_AGE, PERSON_DOB, PERSON_EMAIL})
> 
> -- name=1, attributes=2, size=3
> -- person_name=1, age=5, dob=6, email=7
> </eucode>
{{{

> 
> An enum is not a new type, it emits a constant. They can be local or global.
> I think it has a lot of benefit but wanted to get community input.
> 
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

I think this is a very good idea. This seems like a relatively safe change to
make, as it only affects the front-end. With something like this in the
language,
I think we could stop worrying about how/whether to implement structures, as
this
pretty much takes care of that.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Enum?

Jeremy Cowgar wrote:
> 
> An enum is not a new type, it emits a constant. They can be local or global.
> I think it has a lot of benefit but wanted to get community input.

I've always wanted this kind of functionality, but got by without it.

It would be interesting to see how much code this would replace in the archive.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Enum?

Alan F wrote:
> 
> Jeremy Cowgar wrote:
> > Etc... This is fine, but what if you want to add a new element and not at
> > the
> > end? I am sure we've all done it. Well, I borrowed a good thing from other
> > languages
> > called an enum (enumeration)... I've done the code already but have not
> > committed.
> > What do you think?
> > 
> > }}}
<eucode>
> > global enum D_NAME, D_ATTRIBUTES, D_SIZE, ...
> > global enum PERSON_NAME, PERSON_AGE=5, PERSON_DOB, PERSON_EMAIL
> > 
> > printf(1, "name=%d, attributes=%d, size=%d\n", {
> >     D_NAME, D_ATTRIBUTES, D_SIZE})
> > printf(1, "person_name=%d, age=%d, dob=%d, email=%d\n", {
> >     PERSON_NAME, PERSON_AGE, PERSON_DOB, PERSON_EMAIL})
> > 
> > -- name=1, attributes=2, size=3
> > -- person_name=1, age=5, dob=6, email=7
> > </eucode>
{{{

> > 
> > An enum is not a new type, it emits a constant. They can be local or global.
> > I think it has a lot of benefit but wanted to get community input.
> > 
> > --
> > Jeremy Cowgar
> > <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>
> 
> I think this is a very good idea. This seems like a relatively safe change to
> make, as it only affects the front-end. With something like this in the
> language,
> I think we could stop worrying about how/whether to implement structures, as
> this
> pretty much takes care of that.

Static structures, yeas. Still, go for it, Jeremy!

Kat

new topic     » goto parent     » topic index » view message » categorize

5. Re: Enum?

Kat wrote:
> 
> Alan F wrote:
> > 
> > Jeremy Cowgar wrote:
> > > Etc... This is fine, but what if you want to add a new element and not at
> > > the
> > > end? I am sure we've all done it. Well, I borrowed a good thing from other
> > > languages
> > > called an enum (enumeration)... I've done the code already but have not
> > > committed.
> > > What do you think?
> > > 
> > > }}}
<eucode>
> > > global enum D_NAME, D_ATTRIBUTES, D_SIZE, ...
> > > global enum PERSON_NAME, PERSON_AGE=5, PERSON_DOB, PERSON_EMAIL
> > > 
> > > printf(1, "name=%d, attributes=%d, size=%d\n", {
> > >     D_NAME, D_ATTRIBUTES, D_SIZE})
> > > printf(1, "person_name=%d, age=%d, dob=%d, email=%d\n", {
> > >     PERSON_NAME, PERSON_AGE, PERSON_DOB, PERSON_EMAIL})
> > > 
> > > -- name=1, attributes=2, size=3
> > > -- person_name=1, age=5, dob=6, email=7
> > > </eucode>
{{{

> > > 
> > > An enum is not a new type, it emits a constant. They can be local or
> > > global.
> > > I think it has a lot of benefit but wanted to get community input.
> > > 
> > > --
> > > Jeremy Cowgar
> > > <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>
> > 
> > I think this is a very good idea. This seems like a relatively safe change
> > to
> > make, as it only affects the front-end. With something like this in the
> > language,
> > I think we could stop worrying about how/whether to implement structures, as
> > this
> > pretty much takes care of that.
> 
> Static structures, yeas. Still, go for it, Jeremy!
> 
> Kat

It would have saved me - no exaggeration - several day's work. 
Please add enums.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Enum?

Jeremy Cowgar wrote:
> 
> I do this all the time and I know others do because I see in it code
> everywhere.
> Here are some examples, some of which you will recognize:

Yes, I do this OFTEN! However, I use a execute-time mechanism to make it less
error prone ...

include series.e
constant 
   sFILE                = next-number(0),
   FILE_NO              = next-number(sFILE),
   LINE_NO              = next-number(sFILE),
   FILE_PTR             = next-number(sFILE),
   FILE_START_SYM       = next-number(sFILE),
   OP_WARNING           = next-number(sFILE),
   OP_TRACE             = next-number(sFILE),          
   OP_TYPE_CHECK        = next-number(sFILE),
   OP_PROFILE_TIME      = next-number(sFILE),
   OP_PROFILE_STATEMENT = next-number(sFILE),
   OP_DEFINES           = next-number(sFILE),
   maxFILE              = current-number(sFILE)

 
> What do you think?

This idea would be a good addition to the language. It is good because it
happens at parser-time and not execute-time like my solution does.

Just an an idle thought, it is sometimes useful to know the first and last
values (the range) of an enumeration. Can you think of a syntax that would give
us this? Maybe something like this, borrowing from RegEx syntax ...

enum
   FILE_NO,
   LINE_NO,
   FILE_PTR,
   FILE_START_SYM,
   OP_WARNING,
   OP_TRACE,
   OP_TYPE_CHECK,
   OP_PROFILE_TIME,
   OP_PROFILE_STATEMENT,
   OP_DEFINES,
   minFILE=^, -- first enumeration value
   maxFILE=$  -- last enumeration value


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

7. Re: Enum?

Jeremy Cowgar wrote:
> 
> I do this all the time and I know others do because I see in it code
> everywhere.
> Here are some examples, some of which you will recognize:
> 
> }}}
<eucode>
> constant FILE_NO = 1,           -- file number
> 	 LINE_NO = 2,           -- local line number
> 	 FILE_PTR = 3,          -- open file number 
> 	 FILE_START_SYM = 4,    -- symbol before start of file
> 	 OP_WARNING = 5,        -- save/restore with/without options
> 	 OP_TRACE = 6,          
> 	 OP_TYPE_CHECK = 7,
> 	 OP_PROFILE_TIME = 8,
> 	 OP_PROFILE_STATEMENT = 9,
>          OP_DEFINES = 10        -- ifdef defines
> 
> global constant GET_SUCCESS = 0,
> 		GET_EOF = -1,
> 		GET_FAIL = 1,
> 		GET_NOTHING = -2
> 
> global constant 
> 	D_NAME = 1,
> 	D_ATTRIBUTES = 2,
> 	D_SIZE = 3,
> 	D_YEAR = 4,
> 	D_MONTH = 5,
> 	D_DAY = 6,
> 	D_HOUR = 7,
> 	D_MINUTE = 8,
> 	D_SECOND = 9
> </eucode>
{{{

> 
> Etc... This is fine, but what if you want to add a new element and not at the
> end? I am sure we've all done it. Well, I borrowed a good thing from other
> languages
> called an enum (enumeration)... I've done the code already but have not
> committed.
> What do you think?
> 
> }}}
<eucode>
> global enum D_NAME, D_ATTRIBUTES, D_SIZE, ...
> global enum PERSON_NAME, PERSON_AGE=5, PERSON_DOB, PERSON_EMAIL
> 
> printf(1, "name=%d, attributes=%d, size=%d\n", {
>     D_NAME, D_ATTRIBUTES, D_SIZE})
> printf(1, "person_name=%d, age=%d, dob=%d, email=%d\n", {
>     PERSON_NAME, PERSON_AGE, PERSON_DOB, PERSON_EMAIL})
> 
> -- name=1, attributes=2, size=3
> -- person_name=1, age=5, dob=6, email=7
> </eucode>
{{{

> 
> An enum is not a new type, it emits a constant. They can be local or global.
> I think it has a lot of benefit but wanted to get community input.
> 
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

Yes, I think with the ubiquity of sequences and how they are used to simulate
structures sometimes, enumerated constants would be a welcome addition.

--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

new topic     » goto parent     » topic index » view message » categorize

8. Re: Enum?

Derek Parnell wrote:
> 
> Just an an idle thought, it is sometimes useful to know the first and last
> values
> (the range) of an enumeration. Can you think of a syntax that would give us
> this? Maybe something like this, borrowing from RegEx syntax ...
> 
> }}}
<eucode>
> enum
>    FILE_NO,
>    LINE_NO,
>    FILE_PTR,
>    FILE_START_SYM,
>    OP_WARNING,
>    OP_TRACE,
>    OP_TYPE_CHECK,
>    OP_PROFILE_TIME,
>    OP_PROFILE_STATEMENT,
>    OP_DEFINES,
>    minFILE=^, -- first enumeration value
>    maxFILE=$  -- last enumeration value
> </eucode>
{{{

> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

 From what I understand, the first entry in any 'enum' statement is always
set to 1. However, the 'last enumeration value' option would be useful
(for example, to define a sequence of that length for holding a structure),
but I wasn't and still am not sure what would be good syntax for this. I'm not
so sure about the $ syntax proposed.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Enum?

>  From what I understand, the first entry in any 'enum' statement is always
> set to 1. However, the 'last enumeration value' option would be useful
> (for example, to define a sequence of that length for holding a structure),
> but I wasn't and still am not sure what would be good syntax for this. I'm not
> so sure about the $ syntax proposed.

Actually, you can set it to anything you want. It defaults to 1 if nothing is
given...

enum NAME=20,AGE,DOB         -- 20,21,22
enum ENGINE,WHEELS,MUFFLER   -- 1,2,3
enum A=-3,B,C,D,E,F          -- -3, -2, -1, 0, 1, 2
enum A,B,C,D=10,E,F          -- 1,2,3,10,11,12


--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » goto parent     » topic index » view message » categorize

10. Re: Enum?

Alan F wrote:

>  From what I understand, the first entry in any 'enum' statement is always
> set to 1. 

Actually it turns out that this is not always the case. Consider ...

enum
   FAILURE = -1,
   OKAY
enum WM_USER = #0400,
     WM_NOTIFY,
     WM_DROPDOWN

In these cases, the first item is not 1.

There is also the case where a coder does this ...

enum 
   OPTA = 2,
   OPTB = 9,
   OPTC = 0,
   OPTD = 7

Here the 'first' one is 2, the 'minimum' one is 0, then 'number of values' is 4,
the 'last' one is 7 and the 'maximum' one is 9.

All these properties (okay maybe not first and last) are useful to know. 


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

11. Re: Enum?

Derek Parnell wrote:
> }}}
<eucode>
> enum
>    FILE_NO,
>    LINE_NO,
>    FILE_PTR,
>    FILE_START_SYM,
>    OP_WARNING,
>    OP_TRACE,
>    OP_TYPE_CHECK,
>    OP_PROFILE_TIME,
>    OP_PROFILE_STATEMENT,
>    OP_DEFINES,
>    minFILE=^, -- first enumeration value
>    maxFILE=$  -- last enumeration value
> </eucode>
{{{


At first I didn't understand it, but after reading other proposals, I like this
idea the best.

I was wondering how you would determine the range of an enum from one of its
members
but if I understand what you are proposing, the ^ and $ symbols are valid from
the
start to the end of the enum statement.

This seems the simplest for a compile-time feature, however
does the entry 'minFILE' count against the value of maxFILE? :)

  ie from your example above:
      intent: minFILE = 1, maxFILE = 10
      actual: minFILE = 1, maxFILE = 11 (because of minFILE)
   
  Maybe you could just store these in constants with ^ and $ available
  until the next enum keyword is encountered? They would have to be better
  named though because of $ being used for slices. eg enum_start, enum_end,
  enum_count ?

But for the sake of not having to change 50 lines of code to insert a 'record'
in a sequence I'm all for this change regardless.

Gary

new topic     » goto parent     » topic index » view message » categorize

12. Re: Enum?

gshingles wrote:
> 
> Derek Parnell wrote:
> > }}}
<eucode>
> > enum
> >    FILE_NO,
> >    LINE_NO,
> >    FILE_PTR,
> >    FILE_START_SYM,
> >    OP_WARNING,
> >    OP_TRACE,
> >    OP_TYPE_CHECK,
> >    OP_PROFILE_TIME,
> >    OP_PROFILE_STATEMENT,
> >    OP_DEFINES,
> >    minFILE=^, -- first enumeration value
> >    maxFILE=$  -- last enumeration value
> > </eucode>
{{{

> 
> At first I didn't understand it, but after reading other proposals, I like
> this
> idea the best.
> 
> I was wondering how you would determine the range of an enum from one of its
> members
> but if I understand what you are proposing, the ^ and $ symbols are valid from
> the 
> start to the end of the enum statement.
> 
> This seems the simplest for a compile-time feature, however
> does the entry 'minFILE' count against the value of maxFILE? :)
> 
>   ie from your example above:
>       intent: minFILE = 1, maxFILE = 10
>       actual: minFILE = 1, maxFILE = 11 (because of minFILE)
>    
>   Maybe you could just store these in constants with ^ and $ available
>   until the next enum keyword is encountered? They would have to be better
>   named though because of $ being used for slices. eg enum_start, enum_end,
>   enum_count ?
> 
> But for the sake of not having to change 50 lines of code to insert a 'record'
> in a sequence I'm all for this change regardless.
> 
> Gary

Me too.

CChris

new topic     » goto parent     » topic index » view message » categorize

13. Re: Enum?

gshingles wrote:

> I was wondering how you would determine the range of an
> enum from one of its members but if I understand what
> you are proposing, the ^ and $ symbols are valid from
> the start to the end of the enum statement.

I was just 'shooting from the hip'. It was not a thought out proposal or syntax.

> does the entry 'minFILE' count against the value of maxFILE? :)

But now I've got a bit of time I'll flesh it out a bit more...

There are three properies of an enumeration that can be useful to know:
(1) The number of elements in the enumeration.
(2) The value of the lowest item.
(3) The value of the highest item.

All of these are known to the parser. I propose that in addition to setting
values in an enumeration, that three special tokens can be used that denote these
three properities on an enumeration.

The tokens I propose are these below ... (but please feel free to come up with
better ones)
(1) enum:length
(2) enum:min
(3) enum:max

When used in an enumeration declaration, they do not themselves become values in
the enumeration.

Example:

enum
   FILE_NO,
   LINE_NO,
   FILE_PTR,
   FILE_START_SYM,
   OP_WARNING=-1,
   OP_TRACE=-2,
   OP_TYPE_CHECK=0,
   OP_PROFILE_TIME=18,
   OP_PROFILE_STATEMENT=3,
   OP_DEFINES=9,
   minFILE=enum:min,   -- lowest enumeration value
   maxFILE=enum:max,   -- highest enumeration value
   lenFILE=enum:length -- count of items in THIS enumeration


This is equivalent to ...
constant
   FILE_NO = 1,
   LINE_NO = 2,
   FILE_PTR = 3,
   FILE_START_SYM = 4,
   OP_WARNING = -1,
   OP_TRACE = -2,
   OP_TYPE_CHECK = 0,
   OP_PROFILE_TIME = 18,
   OP_PROFILE_STATEMENT = 3,  -- note duplicates are okay
   OP_DEFINES = 9,
   minFILE = -2,   -- lowest enumeration value
   maxFILE = 18,   -- highest enumeration value
   lenFILE = 10 -- count of items in THIS enumeration


If used, the special enumeration values MUST be the last ones in the declaration
and each one can be used any number of times (0 or more) before the end of the
enumeration.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

14. Re: Enum?

> On 14 May 2008 at 19:08, Alan F wrote (maybe snipped):

>  From what I understand, the first entry in any 'enum' statement is
>  always
> set to 1. However, the 'last enumeration value' option would be useful
> (for example, to define a sequence of that length for holding a
> structure), but I wasn't and still am not sure what would be good
> syntax for this. I'm not so sure about the $ syntax proposed.
> 

$ makes sense. It is "euphoric" alright (subscripts), but I'm not 
sure about the convenience of "^". Well, I could used to it some day, 
but can't get the point.

Euler

-- 
_
_| euler f german
_| sete lagoas, mg, brazil
_| efgerman{AT}gmail{DOT}com

new topic     » goto parent     » topic index » view message » categorize

15. Re: Enum?

Euler German wrote:
> 
> > On 14 May 2008 at 19:08, Alan F wrote (maybe snipped):
> 
> >  From what I understand, the first entry in any 'enum' statement is
> >  always
> > set to 1. However, the 'last enumeration value' option would be useful
> > (for example, to define a sequence of that length for holding a
> > structure), but I wasn't and still am not sure what would be good
> > syntax for this. I'm not so sure about the $ syntax proposed.
> > 
> 
> $ makes sense. It is "euphoric" alright (subscripts), but I'm not 
> sure about the convenience of "^". Well, I could used to it some day, 
> but can't get the point.
> 
> Euler
> 

In any regular expression description I heard about, ^ stands for start of line
and $ for end of line. Eu will have regular expressions, so these symbols make
sense for first/last term of enum. They are not part of an anum.

Of course, this_enum.start and this_enum.end are more explicit and clear.

CChris

> -- 
> _
> _| euler f german
> _| sete lagoas, mg, brazil
> _| efgerman{AT}gmail{DOT}com
> 
>

new topic     » goto parent     » topic index » view message » categorize

16. Re: Enum?

> On 15 May 2008 at 9:56, CChris wrote (maybe snipped):

> In any regular expression description I heard about, ^ stands for
> start of line and $ for end of line. Eu will have regular expressions,
> so these symbols make sense for first/last term of enum. They are not
> part of an anum.
> 
> Of course, this_enum.start and this_enum.end are more explicit and
> clear.
> 
> CChris
> 

Yeah, I know. Just avoiding a mix-up. Besides, Derek already changed 
his mind on syntax used. :)

I like regexes very much and use them very often, so I got used to 
its terse, cryptic syntax, but could we leave this *only* for regex 
strings? ;)

Euler

-- 
_
_| euler f german
_| sete lagoas, mg, brazil
_| efgerman{AT}gmail{DOT}com

new topic     » goto parent     » topic index » view message » categorize

17. Re: Enum?

Derek Parnell wrote:
> The tokens I propose are these below ... (but please feel free to come up with
> better ones) 
> (1) enum:length
> (2) enum:min
> (3) enum:max
> 
> When used in an enumeration declaration, they do not themselves become values
> in the enumeration.
> 
> Example:
> 
> }}}
<eucode>
> enum
>    FILE_NO,
>    LINE_NO,
>    FILE_PTR,
>    FILE_START_SYM,
>    OP_WARNING=-1,
>    OP_TRACE=-2,
>    OP_TYPE_CHECK=0,
>    OP_PROFILE_TIME=18,
>    OP_PROFILE_STATEMENT=3,
>    OP_DEFINES=9,
>    minFILE=enum:min,   -- lowest enumeration value
>    maxFILE=enum:max,   -- highest enumeration value
>    lenFILE=enum:length -- count of items in THIS enumeration
> </eucode>
{{{


Yep. Looks good, if a bit wordy. 
Isn't ':' for namespaces, or did that become '.' last week?
If it is ':' you might have to do a bit of gymnastics in case you have a
namespace 'enum' ?

I'm for whatever works though and provides the most features with the least
barriers to speedy implementation.

Gary

new topic     » goto parent     » topic index » view message » categorize

18. Re: Enum?

Euler German wrote:
> 
> > On 14 May 2008 at 19:08, Alan F wrote (maybe snipped):
> 
> >  From what I understand, the first entry in any 'enum' statement is
> >  always
> > set to 1. However, the 'last enumeration value' option would be useful
> > (for example, to define a sequence of that length for holding a
> > structure), but I wasn't and still am not sure what would be good
> > syntax for this. I'm not so sure about the $ syntax proposed.
> > 
> 
> $ makes sense. It is "euphoric" alright (subscripts), but I'm not 
> sure about the convenience of "^". Well, I could used to it some day, 
> but can't get the point.

$ and ^ are used in regular expressions to denote 'to the end of it' and 'from
the beginning of it', respectively.

I personally think we should stay away from Perl syntax as much as possible.
It's refreshing to program in a language where you don't have to use as many !
at #$%^&*\ symbols.

(But that doesn't mean I don't think we could borrow some more Perl-ish
_concepts_)

Gary

new topic     » goto parent     » topic index » view message » categorize

19. Re: Enum?

gshingles wrote:
> I personally think we should stay away from Perl syntax as much as possible.
> It's refreshing to program in a language where you don't have to use as many !
> at
> #$%^&*\ symbols.

Well that kind of ruined the impact of the pun...
"a language where you don't have to use as many !#$%^& symbols."

new topic     » goto parent     » topic index » view message » categorize

20. Re: Enum?

> On 15 May 2008 at 20:39, gshingles wrote (maybe snipped):

> Euler German wrote:
> > 
> > > On 14 May 2008 at 19:08, Alan F wrote (maybe snipped):
> > 
> > >  From what I understand, the first entry in any 'enum' statement
> > >  is always
> > > set to 1. However, the 'last enumeration value' option would be
> > > useful (for example, to define a sequence of that length for
> > > holding a structure), but I wasn't and still am not sure what
> > > would be good syntax for this. I'm not so sure about the $ syntax
> > > proposed.
> > > 
> > 
> > $ makes sense. It is "euphoric" alright (subscripts), but I'm not
> > sure about the convenience of "^". Well, I could used to it some
> > day, but can't get the point.
> 
> $ and ^ are used in regular expressions to denote 'to the end of it'
> and 'from the beginning of it', respectively.
> 
> I personally think we should stay away from Perl syntax as much as
> possible. It's refreshing to program in a language where you don't
> have to use as many ! at #$%^&*\ symbols.
> 
> (But that doesn't mean I don't think we could borrow some more
> Perl-ish _concepts_)
> 

Gary,

Perl regex syntax is sort of reference for regular expressions. If 
PCRE (Perl Compatible Regular Expressions) is the choice, that's what 
we'll be using. I think there'll be no problem to use PCRE's regex 
patterns strings (in fact, I think it's good) but that'll be only for 
passing the pattern to regex engine. All the rest shall be plain 
Euphoria.

Euler

-- 
_
_| euler f german
_| sete lagoas, mg, brazil
_| efgerman{AT}gmail{DOT}com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu