Re: Naming of "continue"

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy Cowgar wrote:
> 
> We can name it whatever. I do not really care, what I like is the
> functionality smile
> 
> The reason I choose continue was due to familiarity. Most languages that have
> such a keyword call it continue. I can see where either would work... i.e.
> 
> continue -- at top of loop
> next -- next loop iteration
> 
> But, taken literally, what do either really mean?
> 
> continue -- execution?
> continue -- with next token?
> 
> or
> 
> next -- token?
> next -- statement?
> 
> So, after thinking about it, I felt neither was a perfect name, but continue
> had on it's side name recognition. Neither was self evident but at least most
> people know what continue is. Other languages that have a next keyword are
> usually
> part of the for loop:
> 
> for 1 to 10 do
>   print "Hello"
> next
> 
> They are not put mid block, but are the same thing as our end for or end do.
> 
> Oh, I also did some research and I found several uses of function name next()
> for iterating through lists, tokens, etc...
> 
> Other possible names I came up with are:
> 
> repeat, again, hm... tried to come up with others with no luck.
> 
> Out of: continue, next, repeat, again ... I think repeat or again makes much
> more sense than continue or next. Here are definitions:
> 
>   continue
>        v 1: continue a certain state, condition, or activity; "Keep on
>             working!"; "We continued to work into the night"; "Keep
>             smiling"; "We went on working until well past midnight"
>        4: move ahead; travel onward in time or space; "We proceeded
>           towards Washington"; "She continued in the direction of
>           the hills"; "We are moving ahead in time now"
> 
>   next
>        adj 1: nearest in space or position; immediately adjoining without
>               intervening space; "had adjacent rooms"; "in the next
>               room"; "the person sitting next to me"; "our rooms
>               were side by side" [syn: adjacent, side by side(p)]
>        3: immediately following in time or order; "the following day";
>           "next in line"; "the next president"; "the next item on
>           the list" [syn: following]
> 
>   repeat
>        n : an event that repeats; "the events today were a repeat of
>            yesterday's" [syn: repetition]
>        v 1: to say, state, or perform again; "She kept reiterating her
>             request" [syn: reiterate, ingeminate, iterate, restate,
>              retell]
>        2: make or do or perform again; "He could never replicate his
>           brilliant performance of the magic trick" [syn: duplicate,
>            reduplicate, double, replicate]
>        3: happen or occur again; "This is a recurring story" [syn: recur]
>        4: to say again or imitate; "followers echoing the cries of
>           their leaders" [syn: echo]
>        5: do over; "They would like to take it over again" [syn: take
>           over]
>        6: repeat an earlier theme of a composition [syn: reprise, reprize,
>            recapitulate]
> 
>   again
>        adv : anew; "she tried again"; "they rehearsed the scene again"
>              [syn: once again, once more, over again]
> 1.	once more; another time; anew; in addition: Will you spell your name again,
> please?
> 2.	in an additional case or instance; moreover; besides; furthermore.
> 3.	on the other hand: It might happen, and again it might not.
> 4.	back; in return; in reply: to answer again.
> 5.	to the same place or person: to return again.
> 
> Notice a few: next #1, #4 (there were other definitions that did not apply at
> all to us, same as other words, so I did not include them). repeat #2, #3, #5.
> Again did not have a good definition on dict.org, so I got it from
> dictionary.com...
> again #1, #4
> 
> So, if we were to change from continue and loose the familiarity of it, I
> would
> vote for repeat or again, not next. next has all the same problems as
> continue,
> plus it is used in other languages as a keyword that does something different,
> and it's a common function name.
> 
> Thoughts?
> 
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

The problem I see with repeat is that, in Pascal/Ada, it starts a loop with exit
test at the end, equivalent to the do ... while construct in C. Euphoria doesn't
have it, it would be convenient, I think, even though you can always emulate it
as
while 1 do
--...
    if exit_condition() then 
        exit 
    end if
end while

which would be more easily coded as
repeat
--...
-- until exit_condition()


again means: the _same_ thing another time. I'd use it to repeat the last
iteration, without testing or incrementing, ie something as much the same as the
current iteration. I called it retry.

CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu