in reply to What Is the Purpose of a Line with only Two Semi-Colons?

I've never seen this as an intentional construct in Perl

Do you have a link?

There is a convention for single, double and triple semicolons in LISP, but there it's a comment symbol.

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

  • Comment on Re: What Is the Purpose of a Line with only Two Semi-Colons?

Replies are listed 'Best First'.
Re^2: What Is the Purpose of a Line with only Two Semi-Colons?
by stevieb (Canon) on Aug 22, 2015 at 19:30 UTC

    I'm wondering if this is code that used ;; as a code placeholder, prior to v5.12.0's ellipsis.

      That's a nice idea and thanks, I wasn't aware that the ellipsis already came with 5.12.

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

Re^2: What Is the Purpose of a Line with only Two Semi-Colons?
by 1nickt (Canon) on Aug 22, 2015 at 19:32 UTC

    Sure. The most recent example is here.

    The way forward always starts with a minimal test.

      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:  <%-{-{-{-<

        > 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 )

        Thanks, Anomalous.

        The way forward always starts with a minimal test.
      I can only guess it might be a workaround to separate larger chunks in windows command line.

      But why don't you ask there? :)

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

Re^2: What Is the Purpose of a Line with only Two Semi-Colons?
by pvaldes (Chaplain) on Aug 23, 2015 at 12:46 UTC

    Agree, I double the semicolons normally in lisp and often the # in perl. Just in case I delete one of them by mistake.

    It seems that this is not an obvious error in perl in any case, bad style maybe, but no harm

    perl -Mdiagnostics -Mstrict -Mwarnings -e 'print "ok\n";;;;;;' ok
      > I double the semicolons normally in lisp

      In LISP it's more than just personal taste

      see Comments tips

      but could be that it's mainly an emacs thing.

      update
      Apparently a convention for all dialects, not only emacs

      LISP commenting convention

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