EndWhile

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

EndWhile

Post by USCode »

For improved consistency, please consider adding EndWhile as a keyword to end a While loop.
I'm not saying replace Wend, as it's already very well entrenched and in the BASIC tradition, but also allow EndWhile to be used to end a While loop as well.
This is a really minor request and I only request it because I find PureBasic already pretty consistent. We have EndIf, EndSelect, EndEnumeration, EndInterface, EndStructure, EndWith, EndProcedure, EndImport and EndMacro ... the only other termination keyword with "end" in it is Wend ... just seems like EndWhile would be more consistent there.
I know I could always add a macro like this:

Code: Select all

Macro EndWhile
  Wend
EndMacro
But it would be handy to have it built-in to the language.

Again, a minor request but a "nice to have" IMHO.
Last edited by USCode on Tue May 01, 2012 3:52 am, edited 1 time in total.
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Re: EndWhile

Post by kenmo »

I think I agree. "Wend" is strange and I don't know what other languages use it. "EndWhile" would be more consistent and intuitive to newcomers.

Although I've been using PB for so long I don't even think twice about typing it anymore!
juror
Enthusiast
Enthusiast
Posts: 228
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: EndWhile

Post by juror »

kenmo wrote:I think I agree. "Wend" is strange and I don't know what other languages use it.
It's been part of "basic" syntax from the beginning. Why should we care what other languages use? Basic precedes most of them. :)
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: EndWhile

Post by Foz »

... so on this line of thought, we should also have EndFor and EndRepeat? :|
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: EndWhile

Post by Demivec »

USCode wrote:Again, a minor request but a "nice to have" IMHO.
By way of comment I don't think this request makes sense to have.

Notice the other words you used as examples:
We have EndIf, EndSelect, EndEnumeration, EndInterface, EndStructure, EndWith, EndProcedure, EndImport and EndMacro ... the only other termination keyword with "end" in it is Wend ... just seems like EndWhile would be more consistent there.
I Notice that you left out a few other 'end'-ing keywords. They're all looping words: Next, Until, Forever, and Wend. Would you suggest, for consistency, to use in addition to EndWhile to also moving to EndFor, EndRepeat, EndRepeatALot? That would seem a scary prospect. The alternative of just adding EndWhile and leaving the rest with no 'additions' wouldn't be consistent.

The looping words were chosen (for the most part :wink: ) because they make sense, not because they followed a pattern. To be consistent they should be left as they are without the need of any syntatic sugar. You already mentioned how you would do it with a macro if you wanted it (though, if it is for a beginner you've already moved into more advanced territory).

Furthermore, what about other keywords such as Return, or the function names in libraries: StopDrawing(), Stop3D(), StopSpecialFX(), StopPrinting()?


Even though I'm not a newbie and this is a minor request, I still wouldn't be in favor of this (-1).
Last edited by Demivec on Tue May 01, 2012 10:53 am, edited 1 time in total.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: EndWhile

Post by Little John »

Foz wrote:... so on this line of thought, we should also have EndFor and EndRepeat? :|
... and "EndForEach" and "EndGosub" :x :?:
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: EndWhile

Post by ts-soft »

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
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: EndWhile

Post by MachineCode »

kenmo wrote:"Wend" is strange and I don't know what other languages use it.
:shock: "While/Wend" is in AutoIt, Visual Basic, PowerBasic, RealBasic, Liberty Basic, QBasic, JustBasic...
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: EndWhile

Post by USCode »

Foz wrote:... so on this line of thought, we should also have EndFor and EndRepeat? :|
No, I wasn't suggesting we have those. For-Next and Repeat-Until, those are understandable words in context.
However, I understand Wend has been around forever and is used in many other BASIC-like languages.

Not that Fred was likely to add it anyways! :wink:
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: EndWhile

Post by Tenaja »

When someone has a feature request that they feel important enough to post, and others rant about how lame the request is, it is very annoying. Especially when it is a backwards-compatible request that does not force a change upon people. Unfortunately, users on this board are experts at rants like that. Regardless of the reasons, Fred implements changes as he sees fit regardless of the popularity and/or logical improvement we as users see. Couple that with his lack of time (having been doing this "on the side" for the past few years), and in the end, very few "sugar" requests are implemented. Perhaps he'll sweeten PB up for us a bit after he finishes his recently-announced mind-blowing updates, now that he is back on PB "full time."

Having said that, "wend" is likely the single most common way to end a while loop in all basic languages. This is likely one of those time where the syntax may be confusing and/or frustrating when you are learning a new language, but once you give in and get accustomed to it you soon forget it was ever an issue.

When I first started using PB, I made a macro for LocalVar, because I strongly disliked using "Protected." I'd never seen that keyword used before, and wanted something I would recognize quicker. I'd forgotten all about that until last month I ran into some code I wrote early on. I think I only used the macro for a week, maybe two. By the time I saw so many samples in Help, the Forum and in the many library sites, it kind of became second nature. Perhaps wend will become that way for you; in the meantime, be prepared for a long wait, if it ever comes.
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Re: EndWhile

Post by LuCiFeR[SD] »

USCode wrote:For improved consistency, please consider adding EndWhile as a keyword to end a While loop.
I'm not saying replace Wend, as it's already very well entrenched and in the BASIC tradition, but also allow EndWhile to be used to end a While loop as well.
This is a really minor request and I only request it because I find PureBasic already pretty consistent. We have EndIf, EndSelect, EndEnumeration, EndInterface, EndStructure, EndWith, EndProcedure, EndImport and EndMacro ... the only other termination keyword with "end" in it is Wend ... just seems like EndWhile would be more consistent there.
I know I could always add a macro like this:

Code: Select all

Macro EndWhile
  Wend
EndMacro
But it would be handy to have it built-in to the language.

Again, a minor request but a "nice to have" IMHO.
Wend = W(hile)End. Quite logical as it stands don't you think?
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: EndWhile

Post by USCode »

LuCiFeR[SD] wrote:Wend = W(hile)End. Quite logical as it stands don't you think?
:|

So then ...
If -> Iend
Select -> Send
Procedure -> Pend
With -> Wend ... (this one in particular illustrates why Wend is a bad idea, but it is what it is)
... no thanks. :wink:

Fred's not going to add it anyways, so this is all academic.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: EndWhile

Post by Tenaja »

USCode wrote:Fred's not going to add it anyways, so this is all academic.
I agree.

On the other hand, "wend" sounds like a word, while "iend" does not; "endif" flows smoothly as a word.

In reality, he has clearly chosen his keywords based on existing language syntax.
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Re: EndWhile

Post by kenmo »

MachineCode wrote::shock: "While/Wend" is in AutoIt, Visual Basic, PowerBasic, RealBasic, Liberty Basic, QBasic, JustBasic...
Fair enough. I've only used a few of those, and not recently... Most of my non-PB experience uses "EndWhile" or just braces. :)

Demivec has a good point that none of the loop-keywords start with "End", and I was unaware that "Wend" is the most common keyword to end a "While".

But I don't know why everyone is extrapolating one specific keyword suggestion to dozens more keywords. USCode didn't ask to change For/Next (everyone recognizes those) or Repeat/Until/Forever (these are needed to distinguish how the loop repeats) or StopDrawing/Stop3D/etc (these are library functions not keywords) or Return or ForEach or anything else...

By that logic, you could take any Feature Request, expand it into 50 different feature requests, then argue they're unnecessary. :twisted:

Anyway I am neutral toward adding "EndWhile"... Honestly I would probably still use "Wend" out of habit.
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: EndWhile

Post by Demivec »

kenmo wrote:But I don't know why everyone is extrapolating one specific keyword suggestion to dozens more keywords. USCode didn't ask to change For/Next (everyone recognizes those) or Repeat/Until/Forever (these are needed to distinguish how the loop repeats) or StopDrawing/Stop3D/etc (these are library functions not keywords) or Return or ForEach or anything else...
@kenmo: USCode's feature request was made based on a desire/need for consistency.
Demivec wrote:The alternative of just adding EndWhile and leaving the rest with no 'additions' wouldn't be consistent
Post Reply