Sam Vilain skribis 2005-06-20 12:54 (+1200):
sub AUTOLOAD($_ = $CALLER::$_, [EMAIL PROTECTED]) {
In a way, $_ forms part of the prototype definition, but is out of band
to the regular arguments on @_; it can't interfere with positional
characteristics, or you have to shift it off before you
Juerd skribis 2005-06-20 12:11 (+0200):
sub AUTOLOAD ($w) { return our ::($w) = get_subref_for $w }
sub AUTOLOAD { our ::($^a) = get_subref_for $^a }
That's :=, of course.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
Hi,
I'm still interested in, why alias wouldn't be a native Perl 6 term?
I think, there are several reasons for alias:
- in natural languages, synonims are very often - alias is a synonim
- in Perl 6, currently there's no way to create a reference to a
variable, _with the context of the
Hi,
Is there a way, to catch, if I call a method, that doesn't exists, to
run a default one? I'm thinking about an error handler method. If not,
I would like to propose this:
class MyClass {
method example ($self: $var) {
say HELLO;
}
method default
BÁRTHÁZI András skribis 2005-06-20 17:18 (+0200):
Is there a way, to catch, if I call a method, that doesn't exists, to
run a default one? I'm thinking about an error handler method.
See all the AUTO subs.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
András,
I think you have just discovered AUTOLOAD :-)
OTOH I don't know how the AUTOLOAD mechanism will work in Perl6 compared
to Perl5, or if it has been imlemented in Pugs (yet), but as far as I
remember, in Apocalypse 12 somewhere it says it will work the same(?) as
in Perl5, and what you
Hi,
Is there a way, to catch, if I call a method, that doesn't exists, to
run a default one? I'm thinking about an error handler method.
See all the AUTO subs.
Cool! Where? Is it working currently with Pugs?
Bye,
Andras
On Mon, 20 Jun 2005, BÁRTHÁZI András wrote:
Hi,
I'm still interested in, why alias wouldn't be a native Perl 6 term?
I think, there are several reasons for alias:
I am not arguing against alias, but just wanted to point out something.
- in Perl 6, currently there's no way to create a
BÁRTHÁZI András skribis 2005-06-20 17:34 (+0200):
Cool! Where? Is it working currently with Pugs?
S10. I don't know how much of that is supported by Pugs.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html
On Mon, 20 Jun 2005, BÁRTHÁZI András wrote:
Hi,
Is there a way, to catch, if I call a method, that doesn't exists, to run
a default one? I'm thinking about an error handler method.
See all the AUTO subs.
Cool! Where? Is it working currently with Pugs?
Synposis 10...
abhijit
Abhijit
On 6/20/05, BÁRTHÁZI András [EMAIL PROTECTED] wrote:
- in natural languages, synonims are very often - alias is a synonim
Perl is modeled on natural languages, but that doesn't mean it is one.
At its core, Perl is a limited, artificial language being explicitly
designed with certain goals. One
Hi,
- in natural languages, synonims are very often - alias is a synonim
Perl is modeled on natural languages, but that doesn't mean it is one.
At its core, Perl is a limited, artificial language being explicitly
designed with certain goals. One of those goals is that it should be
as small
On 6/20/05, BÁRTHÁZI András [EMAIL PROTECTED] wrote:
Hi,
- in natural languages, synonims are very often - alias is a synonim
Perl is modeled on natural languages, but that doesn't mean it is one.
At its core, Perl is a limited, artificial language being explicitly
designed with
Hi,
kilobytes := kilobyte; will not work for you (try it), because you
have to declare the variable kilobytes - in the default strict mode.
But you can't say for ex. my kilobytes, if you want to export it.
So you say `our kilobytes ::= kilobyte` (or `:=`, you still haven't
said if alias works
Juerd wrote:
I think there exists an even simpler way to avoid any mess involved.
Instead of letting AUTOLOAD receive and pass on arguments, and instead
of letting AUTOLOAD call the loaded sub, why not have AUTOLOAD do its
thing, and then have *perl* call the sub?
sub AUTOLOAD ($w) { return
On Mon, 2005-06-20 at 12:11 +0200, Juerd wrote:
I think there exists an even simpler way to avoid any mess involved.
Instead of letting AUTOLOAD receive and pass on arguments, and instead
of letting AUTOLOAD call the loaded sub, why not have AUTOLOAD do its
thing, and then have *perl* call
chromatic wrote:
Who says AUTOLOAD will always either call a loaded sub or fail?
Maybe it should be passed a continuation too, then? Then it could
choose exactly what to do with it.
Sam.
On 6/20/05, chromatic [EMAIL PROTECTED] wrote:
On Mon, 2005-06-20 at 12:11 +0200, Juerd wrote:
I think there exists an even simpler way to avoid any mess involved.
Instead of letting AUTOLOAD receive and pass on arguments, and instead
of letting AUTOLOAD call the loaded sub, why not have
chromatic skribis 2005-06-20 14:56 (-0700):
Who says AUTOLOAD will always either call a loaded sub or fail?
I don't recall any clearl spec of Perl 6's AUTOLOAD. If there is
something I missed, say so and please do provide example code. Questions
like the one quoted tend to irritate me.
There is
On Mon, 2005-06-20 at 16:37 -0600, Luke Palmer wrote:
On 6/20/05, chromatic [EMAIL PROTECTED] wrote:
Who says AUTOLOAD will always either call a loaded sub or fail?
Uh, what else can it do? It doesn't have to load a sub to return a
code reference.
I think:
class NullObject
{
sub
chromatic skribis 2005-06-20 15:58 (-0700):
I think:
sub AUTOLOAD {}
is better than:
sub AUTOLOAD { return sub {} }
It's nicer to type, but I think that your preferred syntax means that
the AUTOLOAD sub itself has to call any loaded code, which can mean that it
has to fit
On 6/18/05, Juerd wrote:
Why exactly is the slash not acceptable for you? Almost everyone has
said they like it. I personally find ./method prettier and easier to
type than any of the alternatives.
I don't like it because I think method calls should look like method calls,
and the slash
Kurt skribis 2005-06-20 19:34 (-0400):
However, if it remains official, I expect I'll simply be naming my
invocants, as chromatic has suggested.
Or you can just get your self with a simple (module that does)
macro self () { '$?SELF' }
Juerd
--
On 6/20/05, Juerd wrote:
Or you can just get your self with a simple (module that does)
macro self () { '$?SELF' }
And you could do the same for `./`.
Kurt
Kurt skribis 2005-06-20 19:46 (-0400):
On 6/20/05, Juerd wrote:
Or you can just get your self with a simple (module that does)
macro self () { '$?SELF' }
And you could do the same for `./`.
Certainly.
However, there has proven to be much demand for something like ./method,
and in such
Juerd wrote:
I also don't see the symmetry between AUTOLOAD and AUTOMETH. Two things
bother be about that: LOAD versus METH, while it should be SUB versus
METH, and that METHOD is abbreviated while in the method keyword it is
not. Either it should be abbreviated everywhere: meth foo { ... }, or
On Mon, Jun 20, 2005 at 04:37:31PM -0600, Luke Palmer wrote:
On 6/20/05, chromatic [EMAIL PROTECTED] wrote:
On Mon, 2005-06-20 at 12:11 +0200, Juerd wrote:
I think there exists an even simpler way to avoid any mess involved.
Instead of letting AUTOLOAD receive and pass on arguments,
OK, that last discussion was productive, but I think we all (including
myself) overlooked the fact that the AUTOLOAD and AUTOSUB methods are
implied to have different calling conventions;
There is still an AUTOLOAD hook that behaves as in Perl 5.
The (AUTO*) routines are expected to return
Sam Vilain wrote:
It seems these requirements are still in conflict;
- Preserving AUTOLOAD thou-shalt-make-the-call semantics
- Keeping the new $AUTOLOAD off the argument stack for AUTOLOAD()
- Use of $_ as an out-of-band way of passing arguments to a function
cannot be
Rod Adams wrote:
I never liked the idea of out-of-band arguments. Either something is
passed, is available due to being in a broader scope, or can be gleamed
from introspection.
ok. First of all, I agree with the basic sentiment.
However, to play devil's advocate and re-interpret what you
30 matches
Mail list logo