Re: Prototypes

2001-09-04 Thread Damian Conway
Bryan wrote: > > > Er, scratch this. Blows up if the sub isn't prototyped. A much > > > *better* way is to make the prototype of any sub a property > > > (trait) of that sub. We can always query for a property. > > > > This is possible now: > > $foo = sub ($) { print "hello wor

Re: Prototypes

2001-09-04 Thread Bryan C . Warnock
On Tuesday 04 September 2001 11:17 am, Garrett Goebel wrote: > > Er, scratch this. Blows up if the sub isn't prototyped. A > > much *better* way is to make the prototype of any sub a > > property (trait) of that sub. We can always query for a > > property. > > This is possible now: > > $foo = s

RE: Prototypes

2001-09-04 Thread Garrett Goebel
From: Bryan C. Warnock [mailto:[EMAIL PROTECTED]] > > On Monday 03 September 2001 11:56 pm, Bryan C. Warnock wrote: > > The third value is a "peek" value. Do the runtime > > checking, but don't do any magic variable stuff. As a > > matter of fact, don't run any user-code at all. Simply > > re

Re: Prototypes

2001-09-04 Thread Bryan C . Warnock
On Monday 03 September 2001 11:56 pm, Bryan C. Warnock wrote: > The third value is a "peek" value. Do the runtime checking, but don't do > any magic variable stuff. As a matter of fact, don't run any user-code at > all. Simply return a true or false value if the arguments *would* match. > (This

Re: Prototypes

2001-09-03 Thread Damian Conway
> > Are prototypes going to be checked at runtime now? > > For methods, at least. Dunno about subs, that's Larry's call. I > could make a good language case for and against it. It adds > overhead on sub calls, which is a bad thing generally. I would strongly like to see a guarante

Re: Prototypes

2001-09-03 Thread Damian Conway
> But since the current prototyping system... has a highly positive > pressure gradient compared to the surrounding air, Well...I think it's more a problem of "I do no' thin' dat word means wha' you thin' it means". People want prototypes to be parameter type specifiers, when they're actua

Re: Prototypes

2001-09-03 Thread Dan Sugalski
At 11:47 PM 9/3/2001 -0400, Ken Fox wrote: >"Bryan C. Warnock" wrote: > > { > > my $a = sub ($$) { code }; > > gork($a); > > } > > > > sub gork { > > my ($a) = shift; > > $a->(@some_list); # <- Here > > } > > > > The reason prototypes aren't checked at "Here" is because there real

Re: Prototypes

2001-09-03 Thread Bryan C . Warnock
A few more ideas to put down, lest I lay wake all night, thoughts churning... One. Presumably, there will be an op for the actual calling of the subroutine. That op can take an (extra) argument, with one of three values, that the prototype checking can get to. The first value indicates that th

Re: Prototypes

2001-09-03 Thread Ken Fox
"Bryan C. Warnock" wrote: > { > my $a = sub ($$) { code }; > gork($a); > } > > sub gork { > my ($a) = shift; > $a->(@some_list); # <- Here > } > > The reason prototypes aren't checked at "Here" is because there really > isn't a way to know what the prototype was. Um, that's not

Re: Prototypes

2001-09-03 Thread Bryan C . Warnock
On Monday 03 September 2001 10:46 pm, Dan Sugalski wrote: > At 10:32 PM 9/3/2001 -0400, Bryan C. Warnock wrote: > >On Monday 03 September 2001 10:27 pm, Dan Sugalski wrote: > > > >To me, that seems only a language decision. This could certainly > > > > handle that. > > > > > > Ah, but calling in

Re: Prototypes

2001-09-03 Thread Dan Sugalski
At 10:32 PM 9/3/2001 -0400, Bryan C. Warnock wrote: >On Monday 03 September 2001 10:27 pm, Dan Sugalski wrote: > > >To me, that seems only a language decision. This could certainly handle > > >that. > > > > Ah, but calling in the first way has two PMCs in as parameters, while the > > second has o

Re: Prototypes

2001-09-03 Thread Bryan C . Warnock
On Monday 03 September 2001 10:27 pm, Dan Sugalski wrote: > >To me, that seems only a language decision. This could certainly handle > >that. > > Ah, but calling in the first way has two PMCs in as parameters, while the > second has only one. Potentially at least. A world of difference there. A

Re: Prototypes

2001-09-03 Thread Dan Sugalski
At 10:17 PM 9/3/2001 -0400, Bryan C. Warnock wrote: >On Monday 03 September 2001 09:30 pm, Dan Sugalski wrote: > > A clever idea, and one I'd not though of. That's probably the best way to > > do it. Has some other issues, like do we allow prototypes like: > > > >sub foo ($$) {}; > > > > to be

Re: Prototypes

2001-09-03 Thread Bryan C . Warnock
On Monday 03 September 2001 09:30 pm, Dan Sugalski wrote: > A clever idea, and one I'd not though of. That's probably the best way to > do it. Has some other issues, like do we allow prototypes like: > >sub foo ($$) {}; > > to be called as: > >foo(@bar) > > if @bar has two elements in it?

Re: Prototypes

2001-09-03 Thread Dan Sugalski
At 10:11 PM 9/2/2001 -0400, Bryan C. Warnock wrote: >On Sunday 02 September 2001 07:49 pm, Dan Sugalski wrote: > > On Sun, 2 Sep 2001, Bryan C. Warnock wrote: > > > Are prototypes going to be checked at runtime now? > > > > For methods, at least. Dunno about subs, that's Larry's call. I could make

Re: Prototypes

2001-09-02 Thread Bryan C . Warnock
On Sunday 02 September 2001 07:49 pm, Dan Sugalski wrote: > On Sun, 2 Sep 2001, Bryan C. Warnock wrote: > > Are prototypes going to be checked at runtime now? > > For methods, at least. Dunno about subs, that's Larry's call. I could make > a good language case for and against it. It adds overhead

Re: Prototypes

2001-09-02 Thread Dan Sugalski
On Sun, 2 Sep 2001, Bryan C. Warnock wrote: > Are prototypes going to be checked at runtime now? For methods, at least. Dunno about subs, that's Larry's call. I could make a good language case for and against it. It adds overhead on sub calls, which is a bad thing generally. (I'd be OK with the

Re: Prototypes

2001-09-02 Thread Bryan C . Warnock
On Sunday 02 September 2001 08:18 pm, Michael G Schwern wrote: > On Sun, Sep 02, 2001 at 07:47:37PM -0400, Bryan C. Warnock wrote: > > Are prototypes going to be checked at runtime now? > > > > The following parses, but doesn't do anything, including warn. > > > > my $a = sub ($) { print }; > > Wa

Re: Prototypes

2001-09-02 Thread Michael G Schwern
On Sun, Sep 02, 2001 at 07:47:37PM -0400, Bryan C. Warnock wrote: > Are prototypes going to be checked at runtime now? > > The following parses, but doesn't do anything, including warn. > > my $a = sub ($) { print }; Warning because you said you take an argument and then did nothing with it...