[fpc-devel] Fwd: While - Otherwise Statement

wkitty42 at windstream.net wkitty42 at windstream.net
Tue Oct 13 14:34:48 CEST 2015


On 10/13/2015 04:32 AM, Michael Van Canneyt wrote:
>
>
> On Mon, 12 Oct 2015, wkitty42 at windstream.net wrote:
>
>> On 10/12/2015 03:43 PM, Martin Frb wrote:
>>> Actually the above does not represent what the actual feature request is about
>>>
>>> The "else" is to be executed, after the while (even if the while looped ZERO
>>> times).
>>> But it is to be skipped if the while exited via break (and only then).
>>>
>>> For that reason "else" or "otherwise" are badly chosen keywords. Because they
>>> imply a different function.
>>
>> exactly my and others' points... "and" would be better but then one might just
>> as easily use a goto to jump around that part if break was used to get out of
>> the loop...
>>
>> anyway, it seems that no matter what the discussion, it won't make it into the
>> compiler... that according to another post from a compiler dev ;)
>
> Maybe my remark was not clear.
>
> I'm not against this *functionality*.
>
> I merely pointed out that *the syntax using 'else'* is not going to make it
> because it breaks backwards compatibility.

ahhhh... my bad... sorry 'bout that... i've been thinking about this, too... 
'else' and 'otherwise' mean the same thing... what they seem to be looking for 
is 'aswell'...


foo := 0;
while foo < 100 do
   begin
     inc(foo);
   end;
aswell
   begin
     dec(foo);
   end;


either 'aswell' or 'aswellas'... while foo is less than 100 increment foo as 
well as decrement foo when it is no longer less than 100...

i don't see a need for it because in this case if one wants foo to only get to 
99, then they should use 99 as their count...


foo := 0;
while foo < 99 do
   begin
     inc(foo);
   end;


at the end of the loop, foo will equal 99... but it is also a very simple example...


> If another keyword is used: no problem.

ok...

> I don't understand why anyone would want this marginal functionality and thus
> (again) needlessly complicates the language, but hey, it's a (mostly) free
> world....
>
> Alas, the monstrosity that Object Pascal syntax is becoming is less and less
> appealing by the day, it's simply frightening...

it seems that way... but it doesn't mean that we have to use it... we can stay 
with the traditional ways and means within whatever it becomes as long as they 
don't change with these undesirable extensions...

-- 
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list* unless
        private contact is specifically requested and granted.



More information about the fpc-devel mailing list