Page 1 of 1

Plus and minus for Enumeration

Posted: Tue Jan 12, 2010 8:04 pm
by Seymour Clufley
I've been thinking about this for a while:

Code: Select all

Enumeration 5
  #brekn
  #eicnx
  #rerom
  #lvowh +1
  #wtbcu
  #gbsot
  #stbci -2
  #dtisx
EndEnumeration
Any takers?!

Re: Plus and minus for Enumeration

Posted: Tue Jan 12, 2010 9:09 pm
by Kaeru Gaman
ö.Ö

... in your example #dtisx would be the same as #wtbcu ... ?

in my eyes, Enumeration is made to get a row of values without gaps and without doubles...

but ok, since we can have = in enums, why not + and - ? *shrug*

Re: Plus and minus for Enumeration

Posted: Tue Jan 12, 2010 9:19 pm
by Demivec
I don't think it's readable. It took me a few guesses to figure it out and I'm still not sure if I'm right about what you intended to have happen with that sample code.

Based on my guess I would discourage this feature request.

It can already be done this way:

Code: Select all

Enumeration 5
  #brekn
  #eicnx
  #rerom
  #lvowh = #PB_Compiler_EnumerationValue + 1
  #wtbcu
  #gbsot
  #stbci = #PB_Compiler_EnumerationValue - 2
  #dtisx
EndEnumeration

Re: Plus and minus for Enumeration

Posted: Wed Jan 13, 2010 12:10 am
by DoubleDutch
+1 (lol!)

I think it should be added, the + would be really useful (possibly the - too, but not as much as the +).

Re: Plus and minus for Enumeration

Posted: Wed Jan 13, 2010 2:03 am
by Perkin
I thought the whole point of Enumeration is to give a set of #Constants a value which are unique in the set.
If you start mucking about adding and subtracting, why bother with the Enumeration at all, why not just define them all yourself.
I can't see any point for this addition (pun not intended).

Re: Plus and minus for Enumeration

Posted: Wed Jan 20, 2010 9:57 am
by Franky
Should the + just work for that single constant in the line with "+" or should it Step above some numbers for every constant?

Code: Select all

Enumeration 5
#Erste ;=5
#Zweite+5 ;=11 or 10?
#Dritte ;=6 or 11 or 12?
IMHO, an exponential Enumeration could be usefull to create Tags for Procedure Parameters.
You know, like #PB_Window_Invisible=2^28

Code: Select all

Enumeration 2 Exponential
#Tag_Do ;=2
#Tag_Save ;=4
#Tag_Debug ;=8
EndEnumeration
This would be nice :)

Re: Plus and minus for Enumeration

Posted: Wed Jan 20, 2010 11:35 am
by Blue Steel
why would you want to do anything like that...
to me you may as well simply be setting that value manually if thats the case

to me enumeration is just that like a for x=1 to 10 and setting each variable in that loop to the new value.. staps in enumeration i can inderstand ie: step 5 .. so it goes up in 5's but to me doing any math or subtraction is not what enumeration is for. but then i guess thats just me