in reply to One-liners: Conditionals in Loops

The trailing modifiers (putting if/while/unless/until/foreach after an expression) come from BASIC-PLUS, which Larry and I both hacked earlier in our respective lives.

In BASIC-PLUS, you could nest them, and the result was always tough to parse as things got bigger. Larry deliberately left the nesting out for clarity, as he confirmed to me during our writing of the first camel together.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: One-liners: Conditionals in Loops

Replies are listed 'Best First'.
Re: •Re: One-liners: Conditionals in Loops
by BrowserUk (Patriarch) on Nov 04, 2003 at 22:11 UTC

    Didn't we have to wait for BASIC +2 for the nested modifiers? Time passes, memory fades:)

    Also, was LW's concern regarding parsing, that of being for difficult for the compiler, or the human being?


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!
    Wanted!

      Didn't we have to wait for BASIC +2 for the nested modifiers? Time passes, memory fades:)

      Ordinary BASIC/PLUS allowed nested modifiers.

      Also, was LW's concern regarding parsing, that of being for difficult for the compiler, or the human being?

      The parsing would not be difficult for the computer. The concern is for the human being.

        Right you are. I finally managed to track down a copy of the RSTS/E BASIC PLUS language reference on-line. I remember using lines like

        400 READ A(I%) FOR I% = 0 WHILE A(I%) < B

        but in that case, the while is really a special case of the for loop rather than a modifier to it. I couldn't remember if you could use (for example) nested for modofoers on a statement with the interpreter, but I'm pretty sure that I did use the with the compiled version. I've quite often wanted (and typed)

        print $_ for ( @list ) while $_ < CONSTANT; syntax error at (eval 16) line 1, near ") while"

        Personally, I find the modifiers forms of many control statements more closely fit with the way I think, which probably means backwards. It's one of the reasons I took to perl so much from the start.

        It's quite fun scanning the manual and re-discovering stuff I had forgotten. Virtual arrays -- I thought they were the greatest thing since sliced bread when I first encountered them. And xor being called EQV.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        Hooray!
        Wanted!