On 10 Dec 2002 15:34:11 +0000, Simon Cozens wrote:
> [EMAIL PROTECTED] (Peter Haworth) writes:
> > To know whether the method takes a block, you need to know how it's been
> > declared. In other words, the type of @a needs to be known to find
> > grep's declaration.
>
> Well, that's what always happens on a method call.

At run time, yes. However, at compile time, due to Perl's dynamic nature,
you don't know how methods have been declared unless the programmer is using
the optional B&D features.

> > In turn, grep must specify its return type in order to find sort's
> > declaration,
>
> No, not at all. As I've said, you assume that all methods *can* take
> a block.

Fair enough; that simplifies things somewhat. However, you can't tell how
many arguments they take. How do you parse this without the programmer
specifying a great deal more than they're used to in Perl 5?

  $foo.bar $baz,$qux

Is it

  $foo.bar($baz),$qux

or

  $foo.bar($baz.$qux)

or even a syntax error (though this would require bar()'s declaration to be
known at compile time):

  $foo.bar() $baz,$qux

-- 
        Peter Haworth   [EMAIL PROTECTED]
Spider Boardman: I'm having fun with it.
Dan Sugalski: Inside the [perl] tokenizer/lexer? This has got to be the
        scariest thing I've heard in a long time. You are a sick, sick man.

Reply via email to