develooper Front page | perl.perl6.language.subs | Postings from September 2000

RFC 309 (v1) Allow keywords in sub prototypes

From:
Perl6 RFC Librarian
Date:
September 25, 2000 13:14
Subject:
RFC 309 (v1) Allow keywords in sub prototypes
Message ID:
20000925201458.6334.qmail@tmtowtdi.perl.org
This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1 TITLE

Allow keywords in sub prototypes

=head1 VERSION

  Maintainer: Simon Cozens <simon@brecon.co.uk>
  Date: 25 Sep 2000
  Mailing List: perl6-language-subs@perl.org
  Number: 309
  Version: 1
  Status: Developing

=head1 ABSTRACT

This is a general way of helping people create their own syntax.

=head1 DESCRIPTION

The perlsub documentation talks about the use of C<&> in a prototype:

    The interesting thing about C<&> is that you can generate new syntax
    with it, provided it's in the initial position

Well, you can, within limits. But it would fix a lot of things that
people believe they want if you could B<really> define your own syntax.

    sub apply (& to @) {
        ...
    }

    apply { this } to @that;

=head1 IMPLEMENTATION

This becomes a B<little> bit of a nightmare for the parser; but TeX
manages it.

In fact, it's not as hard as it looks, because you still know what
you're expecting: after a block, we want some whitespace and the
keyword "to", then some more whitespace and an array. Since we may well
be having the parser dynamically modifiable, this should be easy. Yeah,
right.

=head1 REFERENCES

RFC 57: Subroutine prototypes and parameters

L<perlsub|perlsub>

RFC ??: Byte-compiled Parser

RFC ??:C<use syntax>




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