develooper Front page | perl.perl6.language | Postings from August 2009

Embedded comments: two proposed solutions to the comment-whole-lines problem

Thread Next
From:
Carl Mäsak
Date:
August 10, 2009 09:31
Subject:
Embedded comments: two proposed solutions to the comment-whole-lines problem
Message ID:
16d769b70908100931t3c6ebb75q7674e3229f65fd52@mail.gmail.com
In my post "Three things in Perl 6 that aren't so great" [0], I
outline three things about Perl 6 that bug me at present. Commenter
daxim made what seems to me a sensible proposal [1] for solving the
third problem, "Comments in the beginning of lines":

daxim (]):
] Let single # be used for commenting out, no matter what follows.
] Let ## (perhaps also ### and so on) switch on the special behaviour
] of brackets etc.

I just want to say that this makes sense to me, both from a Huffmanian
standpoint, and from the standpoint of the principle of least
surprise. It doesn't make embedded comments much more convenient,
because C<##(this)> isn't much more cumbersome to write than
C<#(this)>. And it solves the commenting-out-whole-lines problem.

In the aftermath of YAPC::EU, the question of embedded comments was
also touched upon, and another solution was discussed: leave things as
they are currently specced, but don't consider C<#{> the start of an
embedded comment -- in other words, all other bracketing characters
can still be used to make embedded comments, but the curly braces can
not. This, if I remember the discussions correctly, had two
advantages:

1. It makes it safe(r) for the user to think 'closure' when she sees a
C<{...}> block. Even in interpolated strings, it's a closure.

2. At least parts of the commenting-out-whole-lines problem would go away.

It would be nice to hear p6l-ers' reactions on these two proposals. Be
warned, though -- this is a bit of a bikeshedding topic. :) Every one
and his dog is an expert on comment syntax.

[0] http://use.perl.org/~masak/journal/39334
[1] http://use.perl.org/comments.pl?sid=43438&cid=69583

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About