Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.perl.misc > #8796

Re: names, values, boxes and microchips

From Rainer Weikusat <rweikusat@mssgmbh.com>
Newsgroups comp.lang.perl.misc
Subject Re: names, values, boxes and microchips
Date 2013-07-22 01:20 +0100
Message-ID <87li4zsawk.fsf@sapphire.mobileactivedefense.com> (permalink)
References (1 earlier) <87r4es5idv.fsf@sapphire.mobileactivedefense.com> <fogtba-pi21.ln1@anubis.morrow.me.uk> <87r4er1yh9.fsf@sapphire.mobileactivedefense.com> <sn1uba-8851.ln1@anubis.morrow.me.uk> <kshqtl$u0r$1@speranza.aioe.org>

Show all headers | View raw


Charles DeRykus <derykus@gmail.com> writes:
> On 7/21/2013 2:51 PM, Ben Morrow wrote:
>>
>> Quoth Rainer Weikusat <rweikusat@mssgmbh.com>:
>>> Ben Morrow <ben@morrow.me.uk> writes:
>> ...
>> Let's look at the main loop from your original post:
>>
>>      LOOP: {

[...]

>> 	given ($rc) {
>> 	    when (R_AFTER) {
>> 		push(@out, $in_item);
>> 		&$step_in;
>> 	    }

[...]

>> 	redo;
>>      }
>>
>> When does it terminate? How does it make progress? It's not even
>> immediately clear it's a *loop*: while (1) or for (;;) are the
>> conventional idioms.
>> ...
>
> Even a more expressive 'do' might help a dizzy brain:
>
>
> do {
>      ....
> }
> until $in_pos == @$in or $filter_pos == @$filter;

That's what I originally did. But I didn't like the fact that I had to
assign something to the 'top of the list' variable after the
termination condition for the loop became true only to postpone the
check for that to the 'more conventional' location, especially
considering that I also write code in languages (PL/Pgsql) where the
most basic looping construct is really just

loop
	-- do something
end loop

Loops with multiple termination conditions 'trueness' of which
becomes available as the 'loop body' processing proceeds are not that
uncommon and I thought it might be clearer to omit the 'mock loop
condition' at all since 'blocks are just single-iteration loops' (but
they don't have to be single-iteration). I haven't yet come to some
final opinion on this.

Back to comp.lang.perl.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

names, values, boxes and microchips Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-16 21:45 +0100
  Re: names, values, boxes and microchips Ben Morrow <ben@morrow.me.uk> - 2013-07-19 17:07 +0100
    Re: names, values, boxes and microchips Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-19 17:38 +0100
      Re: names, values, boxes and microchips Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-19 19:28 +0100
        Re: names, values, boxes and microchips Ben Morrow <ben@morrow.me.uk> - 2013-07-20 00:11 +0100
          Re: names, values, boxes and microchips Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-20 15:02 +0100
            Re: names, values, boxes and microchips Ben Morrow <ben@morrow.me.uk> - 2013-07-20 16:45 +0100
            Re: names, values, boxes and microchips Rainer Weikusat <rw@sapphire.mobileactivedefense.com> - 2013-07-21 11:15 +0100
              Re: names, values, boxes and microchips gamo@telecable.es - 2013-07-21 12:47 +0000
                Re: names, values, boxes and microchips Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid> - 2013-07-23 07:14 -0400
                Re: names, values, boxes and microchips gamo@telecable.es - 2013-07-23 20:43 +0000
                Re: names, values, boxes and microchips Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-24 11:23 +0100
                Re: names, values, boxes and microchips Ben Morrow <ben@morrow.me.uk> - 2013-07-23 23:10 +0100
              Re: names, values, boxes and microchips Ben Morrow <ben@morrow.me.uk> - 2013-07-21 18:01 +0100
                Re: names, values, boxes and microchips Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-21 20:53 +0100
                Re: names, values, boxes and microchips Ben Morrow <ben@morrow.me.uk> - 2013-07-21 22:51 +0100
                Re: names, values, boxes and microchips Charles DeRykus <derykus@gmail.com> - 2013-07-21 16:29 -0700
                Re: names, values, boxes and microchips Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-22 01:20 +0100
                Re: names, values, boxes and microchips Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-22 01:06 +0100
                [OT] naming conventions Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-22 10:35 +0100

csiph-web