Names for Enumerations?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
NicTheQuick
Addict
Addict
Posts: 1504
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Names for Enumerations?

Post by NicTheQuick »

What about setting names to enumerations?

Code: Select all

Enumeration Foo
  #hello
  #there
EndEnumeration

Debug Foo\#hello
Debug Foo\#there
But I don't no it's useful to use '#' furthermore.

Another idea is to make it like the following code:

Code: Select all

Enumeration Foo
  #hello
  #there
EndEnumeration

Debug #Foo_hello
Debug #Foo_there
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

Why?
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Your second example is no different to :

Code: Select all

Enumeration
  #Foo_hello 
  #Foo_there 
EndEnumeration 

Debug #Foo_hello 
Debug #Foo_there 
Your first notion seems to be heading towards the VB style of enumeration which is a typed variable rather than a simple listing of constants. Personally I have never really seen the point of the VB enumerated type. Perhaps that's just me though! :) However, mixing the VB type with PB's use of the enumeration to assist with constants is pretty much a non-goer I reckon!

Beside's, any alteration to the Enumeration / EndEnumeration compiler construct will kill just about every program I have ever written and I will in turn kill whoever is responsible for such an alteration!!! :wink:
I may look like a mule, but I'm not a complete ass.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Good idea, but only with compilercheck of parameter:

Code: Select all

Enumeration Foo
  #hello
  #there
EndEnumeration

Debug Foo\#hello
Debug Foo\#there

Procedure bla(first.Foo, second.l)

EndProcedure
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

Another Problem: Enumeration already HAS arguments.

Code: Select all

Enumeration [<constant> [Step <constant>]]
oh... and have a nice day.
Post Reply