While...Wend


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 8 123 ... LastLast
Results 1 to 15 of 107

Thread: While...Wend

  1. #1
    David Bayley Guest

    While...Wend

    OK, I can't take it any more... I fess up... I'm a While/Wend user!

    It has become apparent in the discussions on VB.NET, that every other
    developer has dropped While/Wend in favour of Do/Loop... but why?

    I very rarely have to resort to a Do/Loop, and the only reason for doing so
    is when an Exit Do is required. Having the clear distinction between a loop
    that can be exited prematurely, and one that can't, makes my code clearer
    and more maintainable. Its a Goto thing... so come on folks, whazzup with
    the downer on While/Wend?

    FWIW, the change to End While doesn't really bother me. In fact, I often
    used to accidently write End While anyway, because it was the natural syntax
    to use. The wizard won't have a problem with it, so neither have I (or the
    next generation).

    --
    David.


    Russell P. Holsclaw <rholsclaw@rentaudio.com> wrote in message
    news:39f0c028@news.devx.com...
    >
    > If they're going to do that, why didn't they just finally drop the
    > "While/Wend" construct altogether? The reason it wasn't dropped before is
    > that folks still had this anachronism in their code, for better or worse.
    > It's obvious from the change that an entirely new VB crew is in place,

    with
    > radically different attitudes. And some of us don't like every aspect of
    > that attitude.





  2. #2
    Russell P. Holsclaw Guest

    Re: While...Wend

    > I very rarely have to resort to a Do/Loop, and the only reason for doing
    so
    > is when an Exit Do is required. Having the clear distinction between a

    loop
    > that can be exited prematurely, and one that can't, makes my code clearer
    > and more maintainable. Its a Goto thing... so come on folks, whazzup with
    > the downer on While/Wend?


    An interesting viewpoint. True, there is a school of thought that holds
    that an Exit... statement is sort of a "closet GoTo". Certainly, in the
    early days of structured programming theory, the purists held out for
    exiting loops only from the top or the bottom. In practical terms, this
    meant that if you had an "exit from the middle" situation, you had to finish
    out the body of the loop when an If/Then/Else construct and set some sort of
    flag to terminate the loop. Kinda messy, IMHO.

    Later, it was realized that such extra code only further obscured the logic
    and the "Exit-out-of-the-middle" type of statement was born, at least in
    languages where such things didn't already exist.

    Using the While statement because there IS no "Exit" statement for that
    construct is an interesting
    rationale. I wonder, though, if they haven't introduced an "Exit While"
    statement to serve as a companion piece to "End While".

    FWIW, MS's own documentation on While/Wend has this tip at the end:

    "Tip The Do...Loop statement provides a more structured and flexible way
    to perform looping."

    I took that as saying that While/Wend was being deprecated, that Do/Loop was
    preferred. If I'm not mistaken, I believe that While/Wend was a MS
    extension, and that the ANSI standard for Basic specifies Do/Loop. (I don't
    know that for certain, because I don't have an official copy of the ANSI
    standard. Maybe someone who does can confirm.)




  3. #3
    David Bayley Guest

    Re: While...Wend

    Russel,

    > An interesting viewpoint. True, there is a school of thought that holds
    > that an Exit... statement is sort of a "closet GoTo". Certainly, in the
    > early days of structured programming theory, the purists held out for
    > exiting loops only from the top or the bottom. In practical terms, this
    > meant that if you had an "exit from the middle" situation, you had to

    finish
    > out the body of the loop when an If/Then/Else construct and set some sort

    of
    > flag to terminate the loop. Kinda messy, IMHO.


    I agree, and do use Do/Loop when an Exit Do is more practical. More often
    than not though, it isn't needed.

    > Using the While statement because there IS no "Exit" statement for that
    > construct is an interesting
    > rationale. I wonder, though, if they haven't introduced an "Exit While"
    > statement to serve as a companion piece to "End While".


    I don't know whether they have introduced an Exit While, but of course if
    they do, then it destroys my only rationale for using it in the first place
    <g>.

    Somebody else mailed me privately that Do/Loop has become faster than
    While/Wend in VB6. I'm sure at one point it was the other way around.
    Might do some perf tests when this newsgroup dies down <g>.

    --
    David.




  4. #4
    Alan Carter [MSFT] Guest

    Re: While...Wend

    Yes - we've filled that hole. VB.NET supports Exit While.

    Alan Carter
    VB Language PM
    Microsoft

    "David Bayley" <dbayley@aebacus.com> wrote in message
    news:39f46cf9@news.devx.com...
    > Russel,
    >
    > > An interesting viewpoint. True, there is a school of thought that holds
    > > that an Exit... statement is sort of a "closet GoTo". Certainly, in the
    > > early days of structured programming theory, the purists held out for
    > > exiting loops only from the top or the bottom. In practical terms, this
    > > meant that if you had an "exit from the middle" situation, you had to

    > finish
    > > out the body of the loop when an If/Then/Else construct and set some

    sort
    > of
    > > flag to terminate the loop. Kinda messy, IMHO.

    >
    > I agree, and do use Do/Loop when an Exit Do is more practical. More often
    > than not though, it isn't needed.
    >
    > > Using the While statement because there IS no "Exit" statement for that
    > > construct is an interesting
    > > rationale. I wonder, though, if they haven't introduced an "Exit While"
    > > statement to serve as a companion piece to "End While".

    >
    > I don't know whether they have introduced an Exit While, but of course if
    > they do, then it destroys my only rationale for using it in the first

    place
    > <g>.
    >
    > Somebody else mailed me privately that Do/Loop has become faster than
    > While/Wend in VB6. I'm sure at one point it was the other way around.
    > Might do some perf tests when this newsgroup dies down <g>.
    >
    > --
    > David.
    >
    >
    >




  5. #5
    Karl E. Peterson Guest

    Re: While...Wend

    Hi Alan --

    > Yes - we've filled that hole. VB.NET supports Exit While.


    Huh? You're joking, right?

    Why would you add an escape clause for a discontinued control block? Working too
    late, or just fine-tuning that razor-edged torment of folks here?

    Later... Karl
    --
    http://www.mvps.org/vb






  6. #6
    David Bayley Guest

    Re: While...Wend

    Uh OK... I'll start using Do/Loop then <g>.

    Can we add an option to the conversion wizard to convert While/Wend to
    Do/Loop?

    --
    David.


    Alan Carter [MSFT] <alanc@microsoft.com> wrote in message
    news:39f71567$1@news.devx.com...
    > Yes - we've filled that hole. VB.NET supports Exit While.
    >
    > Alan Carter
    > VB Language PM
    > Microsoft





  7. #7
    Alan Carter [MSFT] Guest

    Re: While...Wend

    While ... Wend isn't discontinued. We've just cleaned it up by mapping the
    weird keyword "Wend" to the more consistent and more readable "End While"

    Alan Carter
    VB Language PM
    Microsoft

    "Karl E. Peterson" <karl@mvps.org> wrote in message
    news:39f72297$1@news.devx.com...
    > Hi Alan --
    >
    > > Yes - we've filled that hole. VB.NET supports Exit While.

    >
    > Huh? You're joking, right?
    >
    > Why would you add an escape clause for a discontinued control block?

    Working too
    > late, or just fine-tuning that razor-edged torment of folks here?
    >
    > Later... Karl
    > --
    > http://www.mvps.org/vb
    >
    >
    >
    >
    >




  8. #8
    Karl E. Peterson Guest

    Re: While...Wend

    Hi Alan --

    > While ... Wend isn't discontinued. We've just cleaned it up by mapping the
    > weird keyword "Wend" to the more consistent and more readable "End While"


    Ahhhh! Interesting. I'm curious why didn't you do the job whole-hog and map the
    weird "While" to "Do While", thus allowing mapping of "Wend" to (fully-consistent!)
    "Loop" and avoiding the need for "End While" altogether? I mean, if you're gonna
    clean up, no fair sweeping under the rug! <g>

    Btw, when you say "mapping" above, aren't you really refering to wizzing?

    Thanks... Karl
    --
    http://www.mvps.org/vb






  9. #9
    Larry Serflaten Guest

    Re: While...Wend

    "Alan Carter [MSFT]" <alanc@microsoft.com> wrote in message news:39f9ae2d$1@news.devx.com...
    > While ... Wend isn't discontinued. We've just cleaned it up by mapping the
    > weird keyword "Wend" to the more consistent and more readable "End While"
    >
    > Alan Carter
    > VB Language PM
    > Microsoft
    >


    Can you eloborate on the merits of a philosphy that supports this type of redunancy?
    The keyword list for VB is already large and I don't mind adding to it if you're adding
    new (previously difficult) functions, but shouldn't your team be looking to streamline
    VB, as you clean it up?

    In this case the Do / Loop can perform exactly the same functionality:

    Do While X
    Loop

    And it is more versatile:

    Do
    Loop Until X

    I guess I just don't see the point of making a programming language more
    verbose than it already is, especially when duplicating already attainable
    functionality. Taking redundancy to an extreme perhaps you can see the
    uselessness of it:

    A = B
    Let A = B
    Set A = B
    Equate A To B
    Assign B To A
    Copy B Into A
    Move B Into A
    Duplicate A From B

    Is there really a need for this type of duplication? It can't be on account
    of (software) code generators, because they can generate Do/Loop just
    as easily as While/End While. I don't get it. why clutter the language?

    Perhaps you are not aware that the more keywords you add to the language,
    the more difficult it will be to retain in memory. Some programmers are going to
    try to be versatile in several languages. If each language has its own spin on
    'War and Peace', how easy do you think that is going to be??? Therefore your
    efforts should not be directed toward making VB unnecessarily difficult, but
    rather, you should be packing as much power into each keyword as possible,
    in an attempt to 'normalize' the language. The While/End While structure is
    absolutely useless, in that it provides no functionality that cannot be exactly
    matched using other, similar, keywords.

    Have you ever done a study on how many programs use Switch, or Choose?
    I would add IIf, but that, apparently, does get some use... Keywords like these
    (any that are used in .01% of all programs) should be dropped. That is
    the way to 'clean up' a language.

    I case you missed it, my question was, why are the redundancies not being dropped?

    FWIW the only time I can accept redunant functionality is when a new keyword
    *significantly* adds to performance, over and above the previous (conventional)
    methods.

    LFS (serflaten@usinternet.com)
    President - ChildsPlay Software Services




  10. #10
    Karl E. Peterson Guest

    Re: While...Wend

    Hi Larry --

    I think your concerns:

    -----------
    > I guess I just don't see the point of making a programming language more
    > verbose than it already is, ...

    -----------
    > I don't get it. why clutter the language?

    -----------
    > The While/End While structure is absolutely useless, ...

    -----------
    > ..., how easy do you think that is going to be???

    -----------
    > Therefore your
    > efforts should not be directed toward making VB unnecessarily difficult, ...

    -----------

    were addressed in another of Alan's (recent) posts on msnews:

    "Alan Carter [MSFT]" <alanc@microsoft.com> wrote ...
    > Just to make sure folks are confused about this.

    news://msnews.microsoft.com/#pxj4IrP....microsoft.com

    Seems to be an overriding design goal, eh? Hope this helps! :-)

    Later... Karl
    --
    http://www.mvps.org/vb



  11. #11
    Dan Barclay Guest

    Re: While...Wend

    On Fri, 27 Oct 2000 09:44:13 -0700, "Alan Carter [MSFT]"
    <alanc@microsoft.com> wrote:

    >While ... Wend isn't discontinued. We've just cleaned it up by mapping the
    >weird keyword "Wend" to the more consistent and more readable "End While"


    So, is End While available in VB5/6 so that I can keep parallel code
    base? Yea, that sure helped VB a lot.

    Alan, seriously, this "cleanup" is going to cause a lot of problems
    both for deverlopers and for MS in the press and I strongly encourage
    you to back off of it. Quickly and completely. You're seeing only a
    trickle of complaint right now.

    Changes that aren't *required* by a change to .net should be backed
    out. If it were me I'd say so, and clearly. I'd ship beta1 and fix
    the GI's before Beta 2.

    Just my advice and opinion.

    Some of us would dearly like to help make sure none of the "good
    stuff" from .net is lost in the process. It can be done.

    Dan
    Language Stability is a *feature* I wish VB had!
    (#6)

  12. #12
    Larry Serflaten Guest

    Re: While...Wend

    Yeah, I saw that..

    <he he>
    --
    LFS (serflaten@usinternet.com)
    President - ChildsPlay Software Services


    "Karl E. Peterson" <karl@mvps.org> wrote in message news:39f9ce11$1@news.devx.com...
    > Hi Larry --
    >
    > I think your concerns:
    > were addressed in another of Alan's (recent) posts on msnews:
    >
    > "Alan Carter [MSFT]" <alanc@microsoft.com> wrote ...
    > > Just to make sure folks are confused about this.

    > news://msnews.microsoft.com/#pxj4IrP....microsoft.com
    >
    > Seems to be an overriding design goal, eh? Hope this helps! :-)
    >
    > Later... Karl
    > --
    > http://www.mvps.org/vb





  13. #13
    Alan Carter [MSFT] Guest

    Re: While...Wend

    I think the earlier items in this thread make it clear that there is no way
    we can satisfy everyone's specific goals for the language whether it is
    "change as little as possible" or "remove everything that provides duplicate
    functionality". Trade-offs had to be made between various goals. In
    general, the changes to existing constructs were made to achieve the
    following goals:
    Simplify and make the language more consistent
    Better interoperability with other languages
    Consistency with the .NET Framework

    Any changes that we made obviously have to be weighed against the cost
    encurred on our users for learning the change and porting code. Removing
    the "While" construct would have simplified the language but I think the
    benefit of removing this is outweighed by the cost of the change for users.
    The cost of changing "WEnd" to "End While" could possibly also be greater
    than the benefit and we will be listening to folks give us their opinions on
    this and other changes.

    l
    Alan Carter
    VB Language PM
    Microsoft

    "Dan Barclay" <dbarclay@ih2000.net> wrote in message
    news:39f9dda0.17245718@news.devx.com...
    > On Fri, 27 Oct 2000 09:44:13 -0700, "Alan Carter [MSFT]"
    > <alanc@microsoft.com> wrote:
    >
    > >While ... Wend isn't discontinued. We've just cleaned it up by mapping

    the
    > >weird keyword "Wend" to the more consistent and more readable "End While"

    >
    > So, is End While available in VB5/6 so that I can keep parallel code
    > base? Yea, that sure helped VB a lot.
    >
    > Alan, seriously, this "cleanup" is going to cause a lot of problems
    > both for deverlopers and for MS in the press and I strongly encourage
    > you to back off of it. Quickly and completely. You're seeing only a
    > trickle of complaint right now.
    >
    > Changes that aren't *required* by a change to .net should be backed
    > out. If it were me I'd say so, and clearly. I'd ship beta1 and fix
    > the GI's before Beta 2.
    >
    > Just my advice and opinion.
    >
    > Some of us would dearly like to help make sure none of the "good
    > stuff" from .net is lost in the process. It can be done.
    >
    > Dan
    > Language Stability is a *feature* I wish VB had!
    > (#6)




  14. #14
    Larry Serflaten Guest

    Re: While...Wend

    "Alan Carter [MSFT]" <alanc@microsoft.com> wrote in message news:39fdf5f6$1@news.devx.com...
    > I think the earlier items in this thread make it clear that there is no way
    > we can satisfy everyone's specific goals for the language whether it is
    > "change as little as possible" or "remove everything that provides duplicate
    > functionality". Trade-offs had to be made between various goals. In
    > general, the changes to existing constructs were made to achieve the
    > following goals:
    > Simplify and make the language more consistent
    > Better interoperability with other languages
    > Consistency with the .NET Framework
    >
    > Any changes that we made obviously have to be weighed against the cost
    > encurred on our users for learning the change and porting code. Removing
    > the "While" construct would have simplified the language but I think the
    > benefit of removing this is outweighed by the cost of the change for users.
    > The cost of changing "WEnd" to "End While" could possibly also be greater
    > than the benefit and we will be listening to folks give us their opinions on
    > this and other changes.
    >


    That certainly sounds like '6 of one kind, half a dozen of another'...
    Since your first listed goal was for simplification, which is where Basic
    got its roots, I can't see how you can say its better to leave it in and change
    part of its syntax, over taking it out altogether. Does VB really need 4 types
    of loop structures? For/Next, For/Each, Do/Loop, While/End While

    Since While is also used with Do/Loop, will that not be a source of confusion?

    --
    LFS (serflaten@usinternet.com)
    President - ChildsPlay Software Services>



  15. #15
    Karl E. Peterson Guest

    Re: While...Wend

    Hi Alan --

    I'm really starting to think you guys are clocking too many, perhaps far too many,
    cycles up there?

    > I think the earlier items in this thread make it clear that there is no way
    > we can satisfy everyone's specific goals for the language whether it is
    > "change as little as possible" or "remove everything that provides duplicate
    > functionality". Trade-offs had to be made between various goals.


    Can you re-read that with a straight face? You'd honestly weigh some folks desire to
    see features *removed* against those arguing they should remain? On what possible
    basis? I mean, I can begin to understand it if _you_ just can't pull it off, as
    almost seems to be the case with DF, but to decide to rape the langauge because
    someone told you to...?

    > The cost of changing "WEnd" to "End While" could possibly also be greater
    > than the benefit and we will be listening to folks give us their opinions on
    > this and other changes.


    I actually agree that While/Wend needed to go. It was ugly. And VB *has* a constuct
    that exactly replicates it -- DoWhile/Loop. Why didn't you do the whole job here?
    While/EndWhile is dirty.

    Later... Karl
    --
    http://www.mvps.org/vb




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center