EndWith keyword; what for?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

EndWith keyword; what for?

Post by Psychophanta »

Isn't useless EndWith keyword ? :roll:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Phoenix
Enthusiast
Enthusiast
Posts: 141
Joined: Sun Sep 04, 2005 2:25 am

Re: EndWith keyword; what for?

Post by Phoenix »

It's used after the With keyword so why is it useless?
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

It's not useless! :shock:
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Yes, but if there was omitted nothing would happen.
'With' statement is a precompiler one.
You can write 'With list()' at any place of your code, and after it you can refer to list()\var1 (for example) making: 'With list()\var1' and after it there could be 'With struc2' for example ... and so on... and never need for a EndWith instruction.
So then, why is needed the EndWith statement :?:
The only reason i find is for return to a normal path writing, but i find it a bit nonsense.

(This is a request, it should be in the requests section.)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

With is a macro that goes along and adds stuff to the lines inside the With-EndWith block, fleshing them out to fully qualify the references. I guess it needs to know when to stop, else it would be adding "MyList()" or whatever to every line in the program.
BERESHEIT
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

You all must be crasy...
This is just sick...
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

netmaestro wrote:With is a macro that goes along and adds stuff to the lines inside the With-EndWith block, fleshing them out to fully qualify the references. I guess it needs to know when to stop, else it would be adding "MyList()" or whatever to every line in the program.
Well, that's an explanation about how is internally done the With-EndWith stuff.
But my request disregard how or how not it is done.
I only say that 'With' has no need to be ended with a EndWith, but only ending program or with another 'With'.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Phoenix
Enthusiast
Enthusiast
Posts: 141
Joined: Sun Sep 04, 2005 2:25 am

Post by Phoenix »

EndWith is used to close a With block like this:

Code: Select all

Structure One
  OneItem1.b
  OneItem2.b
  OneItem3.b
EndStructure

Structure Two
  TwoItem1.b
  TwoItem2.b
  TwoItem3.b
EndStructure

With One
  \OneItem1=1
  \OneItem2=2
  \OneItem3=3
EndWith

With Two
  \TwoItem1=1
  \TwoItem2=2
  \TwoItem3=3
EndWith
You couldn't do that without EndWith so that's why it's needed.
Fred
Administrator
Administrator
Posts: 18352
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

It's mostly here to enhance the readibility and ensure than you won't use the orphean '\' feature outside a block by mistake.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Psychophanta wrote:
netmaestro wrote:With is a macro that goes along and adds stuff to the lines inside the With-EndWith block, fleshing them out to fully qualify the references. I guess it needs to know when to stop, else it would be adding "MyList()" or whatever to every line in the program.
Well, that's an explanation about how is internally done the With-EndWith stuff.
But my request disregard how or how not it is done.
I only say that 'With' has no need to be ended with a EndWith, but only ending program or with another 'With'.
That's the same for enumerations as well. But we never heard anything about that. In fact, we don't need the enumeration keyword at all, since we can do #Constant = value and the next constant will get the next value!

I think Fred said the obvious about it.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Trond wrote:In fact, we don't need the enumeration keyword at all, since we can do #Constant = value and the next constant will get the next value!
Agree!
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Psychophanta wrote:
Trond wrote:In fact, we don't need the enumeration keyword at all, since we can do #Constant = value and the next constant will get the next value!
Agree!
But I don't! :wink:
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Trond wrote:
Psychophanta wrote:
Trond wrote:In fact, we don't need the enumeration keyword at all, since we can do #Constant = value and the next constant will get the next value!
Agree!
But I don't! :wink:
I already knew it.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Psychophanta wrote:
Trond wrote:
Psychophanta wrote:
Trond wrote:In fact, we don't need the enumeration keyword at all, since we can do #Constant = value and the next constant will get the next value!
Agree!
But I don't! :wink:
I already knew it.
I already knew that.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Joakim Christiansen wrote:You all must be crasy...
This is just sick...
no its not useless, but its useless calling anyone crazy.. especially when you spell it with an s :lol:
Post Reply