Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Comments in qw// or qqw//

55 views
Skip to first unread message

Demerphq

unread,
Oct 8, 2006, 10:01:24 AM10/8/06
to perl6-l...@perl.org
A long while back Damian said I should follow up on the subject of
comments in qw// like constructs, and how useful they would be.

So im following up. Juerd said this is the right place.

If its not obvious why this would be nice: qw() is often used as a
list constructor for things like options or hash elements, and it
would be convenient to have a way to selectively comment out certain
elements. In perl 5 you have to C&P out the offending part and then
stick it in a comment later on. Or hand hack a custom qw//, which for
quick fixes, and stuff like that is a bit annoying.

Cheers,
Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

Juerd

unread,
Oct 8, 2006, 6:14:42 PM10/8/06
to perl6-l...@perl.org
demerphq skribis 2006-10-08 16:01 (+0200):

> If its not obvious why this would be nice: qw() is often used as a
> list constructor for things like options or hash elements, and it
> would be convenient to have a way to selectively comment out certain
> elements. In perl 5 you have to C&P out the offending part and then
> stick it in a comment later on. Or hand hack a custom qw//, which for
> quick fixes, and stuff like that is a bit annoying.

I think that this feature fits perfectly in qqw// or «», which is
already dubbed "shell-like". Every shell that I know lets you comment
things.

If # is special, you need a way to escape or quote it. qqw already
provides this. I also believe that qqw is much more likely to be used
for constructing hashes than qw, exactly because of the quoting feature.

Shells require comments to be separated from other characters with
whitespace. I think this is a good feature to steal.

my %foo = «
foo "bar baz" # And
quux xyzzy # comments
blah 42#15 # go
red "#FF0000" # here :)
»;

works like

my %foo = (
foo => "bar baz", # And
quux => "xyzzy", # comments
blah => "42#15", # go
red => "#FF0000", # here
);

but with much less punctuation and finger strain.
--
korajn salutojn,

juerd waalboer: perl hacker <ju...@juerd.nl> <http://juerd.nl/sig>
convolution: ict solutions and consultancy <sa...@convolution.nl>

Ik vertrouw stemcomputers niet.
Zie <http://www.wijvertrouwenstemcomputersniet.nl/>.

0 new messages