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

[S06] Types of subroutines/blocks/etc.

1 view
Skip to first unread message

Ingo Blechschmidt

unread,
Apr 10, 2005, 11:42:36 AM4/10/05
to perl6-l...@perl.org
Hi,

A06 states:
> Code
> ____________|________________
> | |
> Routine Block
> ________________|_______________ __|___
> | | | | | | | |
> Sub Method Submethod Multi Rule Macro Bare Parametric
[...]
> (It's not yet clear whether the C<Bare> vs C<Parametric>
> distinction is useful. Some apparently C<Bare> blocks are
> actually C<Parametric> if they refer to C<$_> internally, even
> implicitly. And a C<Bare> block is just a C<Parametric> block
> with a signature of C<()>. More later.)

S06 mentions Bare and Parametric only in the table of standard type
names (with a "at least this week" on top of it).

So, what are the types of the following Code references?
my $foo = sub ($x) { $x }; # isa Code, Routine, Sub?
my $foo = sub () { 42 }; # isa Code, Routine, Sub?

my $foo = -> $x { 42 }; # isa Code, Block, Parametric?
my $foo = { $^x }; # isa Code, Block, Parametric?
my $foo = { say }; # (uses $_) # isa Code, Block, Parametric?

my $foo = { 42 }; # isa Code, Block, Bare?
my $foo = -> { 42 }; # isa Code, Block, Bare?

FWIW, I don't think the distinction Bare<->Parametric is really useful.
And as there's no distinction between C<sub () {...}> and C<sub (...)
{...}> either, I'd vote for dropping the Bare<->Parametric distinction
and updating S06 accordingly.


--Ingo

--
Linux, the choice of a GNU | Wissen ist Wissen, wo man es findet.
generation on a dual AMD |
Athlon! |

0 new messages