in reply to Web forum markup language and the Monastery

Just a quick comment on "shortcuts" along with a favorite soapbox rant.

As has already been well-discussed, and well-considered: whatever character sequence you use for interpolating "shortcuts" will preclude their use as ordinary text, therefore it is best to choose a "rare" character sequence.

The problem is, in the discussion-space of 'computer programming languages' (especially versatile ones like perl) there *are* no rare character sequences. With all the different mini-syntaxes, protocols, idioms and neologisms out there, it's (arguably) impossible to choose a syntax that can never be misinterpreted as a command when it was really intended as plain text. Especially when you limit the command-delimiters to the fewest number of total characters. This is the classic linguistic problem of 'use versus mention'.

Ironically, perl (and unfortunately, perl seems to be alone on this) solves this universal problem *exceptionally* well. Namely, allow the user to specify her *own* command delimiters, and completely obviate the need to add cumbersome 'escape sequences' in nearly all circumstances.

q§This is a $brilliant$ idea.§; "This is a $brilliant idea."; qq^This is a "$brilliant" idea.^; q{This is a $brilli@nt ide@}; qŠThi§ i§ a $brilliant idĽaŠ;

This unique aspect of perl should be on the "best practices" short list of how to solve this particular problem. A+

Replies are listed 'Best First'.
Re^2: Web forum markup language and the Monastery
by ysth (Canon) on Jan 16, 2005 at 20:57 UTC
    Indeed. Let's play chase the delimiters (trying to get deparse to resort to escaping):
    $ perl -MO=Deparse -e'print "foo"' print 'foo'; -e syntax OK $ perl -MO=Deparse -e'print "foo'"'"'"' print q[foo']; -e syntax OK $ perl -MO=Deparse -e'print "foo['"'"'"' print q(foo['); -e syntax OK $ perl -MO=Deparse -e'print "foo(['"'"'"' print q<foo(['>; -e syntax OK $ perl -MO=Deparse -e'print "foo<(['"'"'"' print q{foo<(['}; -e syntax OK $ perl -MO=Deparse -e'print "foo{<(['"'"'"' print q/foo{<(['/; -e syntax OK $ perl -MO=Deparse -e'print "foo/{<(['"'"'"' print q"foo/{<(['"; -e syntax OK $ perl -MO=Deparse -e'print "foo\"/{<(['"'"'"' print q#foo"/{<(['#; -e syntax OK $ perl -MO=Deparse -e'print "foo#\"/{<(['"'"'"' print 'foo#"/{<([\''; -e syntax OK
Re^2: Web forum markup language and the Monastery
by Anonymous Monk on Jan 17, 2005 at 10:07 UTC
    The problem is, in the discussion-space of 'computer programming languages' (especially versatile ones like perl) there *are* no rare character sequences.
    That I do not believe. Sure, every character sequence can occur inside a perl program (just put it inside quotes), but many sequences are rare. And the current delimiters, [ ] are one of the most common. [[ ]] would be far less common. Sure, one can make Perl code that uses [[ ]], but if you'd do some statistics on <code> fragments on Perl monks, you'll see that [ ] is uses far, far more often than [[ ]].

      Hence my suggestion of <[]> something that I dont think I've ever seen in real code. IMO [[]] is all too often found in Perl code:

      my $AoA=[[1,2],[1,3]]
      ---
      demerphq