Perl 6 has three code placeholder operators, known affectionately as the "yada, yada, yada" operator (see List Prefix Precedence in Synopsis 3). It's a matter of (very sarcastic) public record how much I love writing, maintaining, and patching parsers, so I've just sent a very preliminary five-line patch to p5p to add support for ...
to Perl 5.
--- perly.y~ 2008-05-09 17:47:35.000000000 -0700 +++ perly.y 2008-05-09 17:47:41.000000000 -0700 @@ -1227,6 +1227,11 @@ } | WORD | listop + | DOTDOT + { + $$ = newUNOP(OP_DIE, 0, + newSVOP(OP_CONST, 0, newSVpvs("Unimplemented"))) + } ; /* "my" declarations, with optional attributes */
Apply this to recentish bleadperl sources, run perl regen_perly.pl
, rebuild, and now you can run programs such as:
sub foo { ... } foo();
And get an "Unimplemented at file line line." error message.
(Now everyone who complains that I don't code enough to match my talk, please punch yourself in the face.)
Re:Hmm
chromatic on 2008-05-10T17:29:24
???
and!!!
are similar to each other, because they rewrite into thedie
opcode, and that can happen in the lexer. The only problem is, as Ben Morrow pointed out, the lexer can rewrite the???
of??? : 1 : 0;
, which is a mistake. Of course, it's also a horrible bit of code, and it's fixable with?? ? : 1 : 0
.
Re:DOTDOT?
chromatic on 2008-05-10T17:36:17
That patch was a quick hack, but the
DOTDOT
token in the lexer also handles...
. I merely reused it.My newer patches are much cleaner.
Ellipsis operator
laburu on 2008-05-11T05:22:52
I take it that using “ellipsis” to refer to this incipient operator is out of the question.Re:Ellipsis operator
chromatic on 2008-05-11T17:10:16
You might have to wrestle Damian for the right to rename it.