in reply to Re^2: What Is the Purpose of a Line with only Two Semi-Colons?
in thread What Is the Purpose of a Line with only Two Semi-Colons?

I'm the one who posted the example here, and I can confirm that in that case at least, davido's guess below (update: and LanX's above) is quite right: it's a personal formatting convention associated with the REPL I wrote for myself, which collapses all blank lines to nothing. I've seen double-semicolons used in code examples from BrowserUk, but in that case I think it has some actual, functional use in his personal REPL.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^4: What Is the Purpose of a Line with only Two Semi-Colons? (background)
by LanX (Saint) on Aug 23, 2015 at 20:39 UTC
    > I've seen double-semicolons used in code examples from BrowserUk, but in that case I think it has some actual, functional use in his personal REPL.

    some background for those still interested:

    It's about how to deal with continuation lines, i.e. not to eval a single line but a chunk of lines, and how to signal what the author wants.

    The standard Perl "REPL"¹, the debugger, has cumbersome way to signal continuation lines, one has to finish a line with a backspaceslash ²:

    lanx@lanx-1005HA:~$ perl -de0 #... DB<1> while (1) {\ cont: print $x++;\ cont: last if $x >3;\ cont: } 0123 DB<2>

    Other REPL's try to make the distinction by using more than one semicolon, b/c semicolons are safe from other interpretations and a natural choice at the end of the line.

    I remember BUK talking about this. (IIRC only eval after two semicolons)

    I personally patched the debugger in a way to only eval code without syntax error and to continue reading lines till all expressions are closed.

    But after an unintended bug you might be trapped in an endless loop, that's why I added ;; as emergency exit.

    lanx@lanx-1005HA:~$ ipl # ... DB<100> while (1) { print $x++ last if $x> 3; } ;; syntax error at (eval 22)[multi_perl5db.pl:644] line 2, near "++last " DB<101> while (1) { print $x++; last if $x> 3; } 0123 DB<102>

    as you can see I "forgot" the semicolon after the second line and was trapped in an endless loop.

    Others don't wont to rely on such a heavy tool like perl5db.pl and realize a simple REPL with less than 10 lines only.

    HTH!

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

    ¹) quoted since the debugger doesn't print by default

    ²) typo corrected (thx to Midlifexis )

Re^4: What Is the Purpose of a Line with only Two Semi-Colons?
by 1nickt (Canon) on Aug 23, 2015 at 13:53 UTC

    Thanks, Anomalous.

    The way forward always starts with a minimal test.