[Catalyst] what is the type of $context?

Nilson Santos Figueiredo Junior acid06 at gmail.com
Sat Jun 10 06:24:09 CEST 2006


On 6/10/06, A. Pagaltzis <pagaltzis at gmx.de> wrote:
> Well, for one thing, Perl 6 disambiguates functions and methods.
> Also, while you can define functions and methods that have no
> more precisely specified call semantics than "is variadic and
> takes anything," you *can* define more precisely specified
> semantics, unlike in Perl 5.

Well, there's nothing stopping you from implementing this in Perl 5.

You could start with something such as Class::MOP and build your own
Meta Object Protocol for handling precisely specified call semantics.
In fact, it seems that Class::Meta, another module providing this sort
of features, already has some support for it. Associate this with
something like Sub::Signatures and/or other similar modules and it'd
be just a matter of glueing the pieces together.

What Perl 6 provides is just a default way of doing it. But Perl 5 is
perfectly capable of doing it.

> So while Perl 6 won't be as reliably introspectible as a static
> language, it will be much, much easier to write robust code for
> introspection than Perl 5 makes it. Like, *a lot* easier: you
> won't have to rely on guesses and heuristics for *everything*, in
> fact, you'll only have to rely on those for some edge cases, and
> it's likely that they'll be so rare that you'll be able to shrug
> and say "not my fault that it doesn't work."

If you adhere to a convention of specifying introspection meta-data
you won't have to rely on guesses and heuristics (in whatever form
that meta-data is available), this is true for any programming
language. As I said, Perl 6 only provides a meta-data format built
into the core language. I'm not denying it's much more convenient,
etc. I'm just trying to show that Perl 5 has these same capabilities,
it's only waiting for you to implement them.

Perl 6 has a lot of nice features. But, IMO, a default instrospection
API is not a significant one.

I actually think explicit call semantics are a somewhat nice feature
(not that I really miss them though). But they're nice not because
they provide better introspection for the user, but because they might
increase perl's ability to do compile-time validation, for example.

-Nilson Santos F. Jr.



More information about the Catalyst mailing list