A perl5 source filter implementation of the perl6 yada operator '...'.
Update - added '!!!' which is a closer perl6 implementation of '...'
Update 2 - added '???' re tye's node Re: the 'dot dot dot' operator (s/the/another/), also the native '...' becomes the new '...' when this code is used
package dotdotdot; use Filter::Simple; FILTER_ONLY code => sub { s{ \s \Q...\E \s }{ () }gx;}; s{ \s !!! \s } { die("Deferred implementation can't be executed"); }gx; s{ \s \Q???\E \s } { die("Deferred implementation can't be executed"); }gx }; q[ foo bar baz ];

Replies are listed 'Best First'.
Re: the 'dot dot dot' operator (s/the/another/)
by tye (Sage) on Apr 14, 2003 at 16:09 UTC

    Um, ... is already an operator in Perl5. You should at least document that one can't use that anymore if one uses your module. See Re: My day with Damian Conway.

    For the record, I'd rather have !!! and/or ??? instead of ... as I find their visibility much more in line with their importance (and for the reason given in my reply under the node I linked to above).

                    - tye
      Um, ... is already an operator in Perl5.
      Doh! Of course it is :-/
      For the record, I'd rather have !!! and/or ??? instead of ... as I find their visibility much more in line with their importance
      I'll second that. I find ... a little too innocuous looking for an operator which will throw an error unconditionally if executed. So ??? is probably the way to go since it's a syntax error if left unfiltered.
      HTH

      _________
      broquaint

Re: the 'dot dot dot' operator
by diotalevi (Canon) on Apr 14, 2003 at 14:04 UTC

    How about instead of () you insert die("Deferred implementation can't be executed");.

      How about instead of () you insert die("Deferred implementation can't be executed");.
      Perhaps, but when I used it I just wanted a placeholder, not necessarily an abstract op (yes, I made that up ;) and I also have no idea how it will be implemented in perl6 (it may be described in p6l ... somewhere). Maybe we need YAO instead
      package bangbangbang; use Filter::Simple; FILTER_ONLY code => sub { s{ \s \Q!!!\E \s } { die("Deferred implementation can't be executed"); }gx }; q[ ichi ni san ];
      And obligatory example usage
      use bangbangbang; sub foo { !!! } my $bar = sub { !!! }; sub baz { return !!! } eval { foo() } or warn "foo() - $@"; eval { &$bar() } or warn "bar() - $@"; eval { baz() } or warn "baz() - $@"; __output__ foo() - Deferred implementation can't be executed at bbb_test.pl line +3. bar() - Deferred implementation can't be executed at bbb_test.pl line +4. baz() - Deferred implementation can't be executed at bbb_test.pl line +5.

      HTH

      _________
      broquaint

        It occurs to me that I dislike bang-bang-bang because that conflicts with the common idiom bang-bang to booleanize something. Also, I recall dot-dot-dot being proposed elsewhere as a fatal op which on being executed warns that something wasn't complete and it shouldn't have been executed.