Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Bart Lateur
On Tue, 6 Feb 2001 04:36:36 +1100 (EST), Damian Conway wrote: >RFC 271 handles this. Your example would be: > >sub readit { >open F, "< $f" ... >scalar() >} >post readit { >close F; >} The connection between these two things is

Re: Another approach to vtables

2001-02-07 Thread Edwin Steiner
Dan Sugalski wrote: [snip] > That's OK, since my example was wrong. (D'oh! Chalk it up to remnants of > the martian death flu, along with too much blood in my caffeine stream) The > example > > $foo{bar} = $baz + $xyzzy[42]; > > turns into > >baz->vtable->add[NATIVE](foo, baz, xyzzy, key)

Re: PDD 2, vtables

2001-02-07 Thread Tim Bunce
On Tue, Feb 06, 2001 at 12:28:23PM -0500, Dan Sugalski wrote: > At 11:26 AM 2/6/2001 +, Tim Bunce wrote: > >[First off: I've not really been paying attention so forgive me if I'm > >being dumb here. And many thanks for helping to drive this forwards.] > > > >On Mon, Feb 05, 2001 at 05:14:44PM

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Johan Vromans
Bart Lateur <[EMAIL PROTECTED]> writes: > The place where it would be put, would be irrelevant. > > sub readit { > POST { > close F; > } > open F, "< $f" ... > scalar() > } Would the POST be executed if the open fails? Wh

Re: Magic [Slightly Off-Topic... please point me to documentation]

2001-02-07 Thread Bart Lateur
On Tue, 6 Feb 2001 17:53:17 -0200, Branden wrote: >It appears you're blessing one reference and returning another... like > >sub new { >my $key; >my $a = \$key; >my $b = \$key; >bless $a; >return $b; >} > >I think the problem is not with the overloa

Re: Another approach to vtables

2001-02-07 Thread Edwin Steiner
Edwin Steiner wrote: > > Dan Sugalski wrote: > [snip] > > That's OK, since my example was wrong. (D'oh! Chalk it up to remnants of > > the martian death flu, along with too much blood in my caffeine stream) The > > example > > > > $foo{bar} = $baz + $xyzzy[42]; > > > > turns into > > > >baz

Re: vtables: Assignment vs. Aliasing

2001-02-07 Thread Bart Lateur
[CC'ed to language, because I think it's there that it belongs] On Mon, 5 Feb 2001 15:35:18 -0200, Branden wrote: >There are two possible things that could happen when you say: >$a = $b; >@a = @b; # or >%a = %b; > >These two things are assignment and aliasing. No way. Although I th

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread John Porter
Johan Vromans wrote: > > Would the POST be executed if the open fails? Why? Why not? Of course. It's a post-handler on the sub. > All that POST and such do, is obfuscate the flow of control. No more so than contine{} on a loop, or END{} in a file, or DESTROY{} in a class. -- John Porter

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread John Porter
Tony Olekshy wrote: > > I think "always" should be part of an explicit statement, such > as "try", not some implied property of block structure introduced > by a dangling clause (inside or outside). Why? For that matter, why must "try" itself be explicit? It says, "I'm probly gonna put some e

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Ariel Scolnicov
Johan Vromans <[EMAIL PROTECTED]> writes: [...] > But I think this is getting ridiculous. $slightly_joking++; I'd > propose a much nicer and cleaner concept: > > sub readit { > open F ... ; > prog1 { > scalar(); > close F; > } > } > > 'prog1' e

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Glenn Linderman
Tony Olekshy wrote: > I think "always" should be part of an explicit statement, such > as "try", not some implied property of block structure introduced > by a dangling clause (inside or outside). Funny, during the perl6 RFC period, during the discussion of the exception handling RFCs 88 and 119

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Peter Scott
At 09:59 AM 2/7/01 -0500, John Porter wrote: >Tony Olekshy wrote: > > > > I think "always" should be part of an explicit statement, such > > as "try", not some implied property of block structure introduced > > by a dangling clause (inside or outside). > >Why? For that matter, why must "try" itse

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread John Porter
Peter Scott wrote: > > I want the 'try' there for my sake, not Perl's; ... it > helps alert me that the following block is subject to non-local control > flow rules. Huh? Down that road lies the Java madness. eval { foo(); }; sub foo { b

Re: Another approach to vtables

2001-02-07 Thread Branden
Dan Sugalski wrote: > At 01:35 PM 2/7/2001 -0200, Branden wrote: > >2. Making the implementation of `tie' and `overload' more efficient ('cause > >it's very slow in Perl 5). > > No, not at all. This isn't really a consideration as such. (The vtable > functions as desinged are inadequate for most o

Re: PDD 2, vtables

2001-02-07 Thread Branden
Dan Sugalski wrote: > Splitting the vtable into two pieces, with one piece not tied to a PMC, > makes some things impossible. Consider this: > >@foo = @bar * @baz; > > where all three arrays are really matrix types. By the PDD's notion of `key', what would be the `key' of a matrix type ? (I

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
Dan, before I followup your reply to my list of nits about the PDD, can I clarify one thing: destruction. I am assuming that many PMCs will require destruction, eg calling destroy() on a string PMC will cause the memory used by the string data to be freed or whatever. Only very simple PMCs (such

Re: Another approach to vtables

2001-02-07 Thread Branden
David Mitchell wrote: > Perl 5 only supports Perl-mode tieing and overloading - ie, where > the tied or overloaded functions that get called are Perl functions. > This is slow and heavyweight, but it is easy to code (ie you write > a Perl module with a few functions). > Actually, I think Perl 5 s

Re: Another approach to vtables

2001-02-07 Thread Buddha Buck
At 01:14 PM 02-07-2001 -0500, Dan Sugalski wrote: >At 01:35 PM 2/7/2001 -0200, Branden wrote: >>As far as I know (and I could be _very_ wrong), the primary objectives of >>vtables are: >>1. Allowing extensible datatypes to be created by extensions and used in >>Perl. > >Secondarily, yes. > >>2. Ma

Re: PDD 2, vtables

2001-02-07 Thread Dan Sugalski
At 07:05 PM 2/7/2001 +, David Mitchell wrote: >Dan, before I followup your reply to my list of nits about the PDD, >can I clarify one thing: destruction. > >I am assuming that many PMCs will require destruction, eg calling >destroy() on a string PMC will cause the memory used by the string >da

Re: POST blocks (like END, but in a sub or sub-like scope)

2001-02-07 Thread Nicholas Clark
On Wed, Feb 07, 2001 at 05:15:41PM -0600, David L. Nicol wrote: > Nicholas Clark wrote: > > > > On Wed, Feb 07, 2001 at 04:30:24PM -0600, David L. Nicol wrote: > > > > > sub has_post_blocks{ > > > my $i = 3; > > > post { print "i ended up as $i"}; > > >

Re: PDD 2, vtables

2001-02-07 Thread Dan Sugalski
At 06:12 PM 2/7/2001 +, Nicholas Clark wrote: >On Wed, Feb 07, 2001 at 05:54:14PM +, David Mitchell wrote: > > Well, many of the vtable methods are operator-ish rather than value-ish, > > presumably on the grounds of efficiency. A pure 'value' vtable wouldnt > > have add(), concatenate() e

Re: PDD 2, vtables

2001-02-07 Thread Dan Sugalski
At 04:02 PM 2/7/2001 +, David Mitchell wrote: > > >Please see my previous post on the subject. As I pointed there, > implementing > > >|| and && like that breaks short-circuits. > > > > No, it doesn't. Just because you pass in two PMCs doesn't mean that they > > both need to be evaluated. Tho

Re: Another approach to vtables

2001-02-07 Thread Dan Sugalski
At 11:13 AM 2/7/2001 +0100, Edwin Steiner wrote: >Dan Sugalski wrote: >[snip] > > That's OK, since my example was wrong. (D'oh! Chalk it up to remnants of > > the martian death flu, along with too much blood in my caffeine stream) The > > example > > > > $foo{bar} = $baz + $xyzzy[42]; > > > > tu

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
BTW, should the vtable include all the mutator operators too, ie ++, += and so on, on the grounds that an implementation may be able do this more efficiently internally?

Re: PDD 2, vtables

2001-02-07 Thread Nicholas Clark
On Wed, Feb 07, 2001 at 04:03:49PM +, David Mitchell wrote: > BTW, should the vtable include all the mutator operators too, ie > ++, += and so on, on the grounds that an implementation may be able > do this more efficiently internally? ++ and -- are already slightly messy in perl5 pp_preinc,

Re: PDD 2, vtables

2001-02-07 Thread Branden
Nicholas Clark wrote: > ++ and -- are already slightly messy in perl5 > > pp_preinc, pp_postinc, pp_predec and pp_postdec live in with all the ops. > They know how to increment and decrement integers that don't overflow, > and call routines in sv.c to increment and decrement anything else. > > Act

Re: Rare Salt-Water Camel May Be Separate Species

2001-02-07 Thread H . Merijn Brand
On Wed, 7 Feb 2001 15:05:55 +, Simon Cozens <[EMAIL PROTECTED]> wrote: > On Wed, Feb 07, 2001 at 03:33:39PM +0100, H . Merijn Brand wrote: > > On Wed, 7 Feb 2001 09:17:30 -0500, Joshua N Pritikin <[EMAIL PROTECTED]> >wrote: > > > http://www.nytimes.com/2001/02/07/science/07reuters-camel.html

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
Nicholas Clark <[EMAIL PROTECTED]> mused: > On Wed, Feb 07, 2001 at 04:03:49PM +, David Mitchell wrote: > > BTW, should the vtable include all the mutator operators too, ie > > ++, += and so on, on the grounds that an implementation may be able > > do this more efficiently internally? > > ++

RE: PDD 2, vtables [pointers to related documentation]

2001-02-07 Thread Garrett Goebel
From: Tim Bunce [mailto:[EMAIL PROTECTED]] > > On Tue, Feb 06, 2001 at 12:28:23PM -0500, Dan Sugalski wrote: > > > > At 11:26 AM 2/6/2001 +, Tim Bunce wrote: > > > > > > On Mon, Feb 05, 2001 at 05:14:44PM -0500, Dan Sugalski wrote: > > > > > > > > =head2 Core datatypes > > > > > > > > For eas

Re: Another approach to vtables

2001-02-07 Thread Branden
Dan Sugalski wrote: > At 05:41 PM 2/6/2001 -0200, Branden wrote: > > > >I actually don't see a reason why the vtable entries should be the > >opcodes. > > > >Is there? > > > > > > Speed. > > > > > > >Actually, I don't see the problem of defining a C function that would do: > > > > void add(SVA

Re: PDD 2, vtables

2001-02-07 Thread Dan Sugalski
At 06:08 PM 2/7/2001 -0200, Branden wrote: >Dan Sugalski wrote: > > Splitting the vtable into two pieces, with one piece not tied to a PMC, > > makes some things impossible. Consider this: > > > >@foo = @bar * @baz; > > > > where all three arrays are really matrix types. > >By the PDD's notion

Rare Salt-Water Camel May Be Separate Species

2001-02-07 Thread Joshua N Pritikin
http://www.nytimes.com/2001/02/07/science/07reuters-camel.html -- May the best description of competition prevail. (via, but not speaking for Deutsche Bank)

Re: Rare Salt-Water Camel May Be Separate Species

2001-02-07 Thread H . Merijn Brand
On Wed, 7 Feb 2001 09:17:30 -0500, Joshua N Pritikin <[EMAIL PROTECTED]> wrote: > http://www.nytimes.com/2001/02/07/science/07reuters-camel.html Which is of no use if you don't have a subscriber ID (and do not want to have one) to th NYT, since it is quite useless in europe ... -- H.Merijn Bran

Re: Rare Salt-Water Camel May Be Separate Species

2001-02-07 Thread Simon Cozens
On Wed, Feb 07, 2001 at 03:33:39PM +0100, H . Merijn Brand wrote: > On Wed, 7 Feb 2001 09:17:30 -0500, Joshua N Pritikin <[EMAIL PROTECTED]> wrote: > > http://www.nytimes.com/2001/02/07/science/07reuters-camel.html > > Which is of no use if you don't have a subscriber ID (and do not want to have

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
Some comments about the vtable PDD... First a general comment. I think we really need to make it clear for each method, which arg respresents the object that is having its method called (ie which is $self/this so to speak). One way to make this clear would be to insist that the first arg is alway

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
> >Please see my previous post on the subject. As I pointed there, implementing > >|| and && like that breaks short-circuits. > > No, it doesn't. Just because you pass in two PMCs doesn't mean that they > both need to be evaluated. Though the PDD does need to be clearer about how > that happens

Re: PDD 2, vtables

2001-02-07 Thread Dan Sugalski
At 04:15 PM 2/7/2001 -0200, Branden wrote: >David Mitchell wrote: > > > > Well, many of the vtable methods are operator-ish rather than value-ish, > > presumably on the grounds of efficiency. A pure 'value' vtable wouldnt > > have add(), concatenate() etc. Whihc leads me back to: I'm not sure > >

Re: Another approach to vtables

2001-02-07 Thread Branden
Dan Sugalski wrote: > > >2. Making the implementation of `tie' and `overload' more efficient ('cause > >it's very slow in Perl 5). > > No, not at all. This isn't really a consideration as such. (The vtable > functions as desinged are inadequate for most overloading, for example) > Well, if it's

Re: Another approach to vtables

2001-02-07 Thread David Mitchell
> Dan, > > I think there is a real problem with your vtable approach. [ etc etc ] I think there's an important misconception about tieing and overloading going on hre which I will attempt to clear up. (Then Dan and co can point out that I;'m I;m wrong and have just made matters worsse ;-) Firs

Re: Another approach to vtables

2001-02-07 Thread Branden
Branden wrote: > > Well, if it's not tie/overload, I didn't really understand why a vtable > would have to be attached to a variable. I'd really like to see an example > of variables whose vtables would have set_* and get_* different one from > another, and another example of variables whose vtabl

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
> > > ++ and -- are already slightly messy in perl5 > > > > > > pp_preinc, pp_postinc, pp_predec and pp_postdec live in with all the ops. > > > They know how to increment and decrement integers that don't overflow, > > > and call routines in sv.c to increment and decrement anything else. > > > >

Re: PDD 2, vtables

2001-02-07 Thread David Mitchell
> >I'm not either. They feel like they should be operators. > >But I don't like the thought of going in and out of a lot of generic > >routines for > > > >$a = 3; > >$a += 2; > > > >when the integer scalar ought to know what the inside of another integer > >scalar looks like, and that 2 + 3 doesn'

Re: PDD 2, vtables

2001-02-07 Thread Dan Sugalski
At 03:09 PM 2/7/2001 +, David Mitchell wrote: >Some comments about the vtable PDD... > >First a general comment. I think we really need to make it clear for >each method, which arg respresents the object that is having its method >called (ie which is $self/this so to speak). One way to make th

Re: Another approach to vtables

2001-02-07 Thread Branden
Dan, I think there is a real problem with your vtable approach. It involves tying, overloading and assignment. I'm not sure if I really got what you meant with the PDD, but I'm assuming: 1. PMC's replace SV*. 2. Tying is handled by vtables that implement set_* and get_* entries to do the magic s

Re: Another approach to vtables

2001-02-07 Thread Dan Sugalski
At 02:33 PM 2/7/2001 -0500, Buddha Buck wrote: >At 01:14 PM 02-07-2001 -0500, Dan Sugalski wrote: >>At 01:35 PM 2/7/2001 -0200, Branden wrote: >>>As far as I know (and I could be _very_ wrong), the primary objectives of >>>vtables are: >>>1. Allowing extensible datatypes to be created by extension

Re: PDD 2, vtables

2001-02-07 Thread Branden
Dan Sugalski wrote: > At 03:09 PM 2/7/2001 +, David Mitchell wrote: > >A mere detail, but would it not be more efficient to just pass them > >as extra args, ie add(PMC1, PMC2, PMC3, key1, key2, key3), > >rather than having to potentially create and populate a tmp struct > >just to call the fun

Re: PDD 2, vtables

2001-02-07 Thread Nicholas Clark
On Wed, Feb 07, 2001 at 05:54:14PM +, David Mitchell wrote: > Well, many of the vtable methods are operator-ish rather than value-ish, > presumably on the grounds of efficiency. A pure 'value' vtable wouldnt > have add(), concatenate() etc. Whihc leads me back to: I'm not sure > whether you ar

Re: PDD 2, vtables

2001-02-07 Thread Branden
David Mitchell wrote: > > Well, many of the vtable methods are operator-ish rather than value-ish, > presumably on the grounds of efficiency. A pure 'value' vtable wouldnt > have add(), concatenate() etc. Whihc leads me back to: I'm not sure > whether you are in favour of, or oppose, += etc being

Re: Another approach to vtables

2001-02-07 Thread Dan Sugalski
At 01:35 PM 2/7/2001 -0200, Branden wrote: >Dan Sugalski wrote: > > At 05:41 PM 2/6/2001 -0200, Branden wrote: > > > > >I actually don't see a reason why the vtable entries should be the > > >opcodes. > > > > >Is there? > > > > > > > > Speed. > > > > > > > > > >Actually, I don't see the problem of

Re: PDD 2, vtables

2001-02-07 Thread Nicholas Clark
On Wed, Feb 07, 2001 at 05:19:16PM +, David Mitchell wrote: > Nicholas Clark <[EMAIL PROTECTED]> mused: > > On Wed, Feb 07, 2001 at 04:03:49PM +, David Mitchell wrote: > > > BTW, should the vtable include all the mutator operators too, ie > > > ++, += and so on, on the grounds that an impl

Re: Another approach to vtables

2001-02-07 Thread Dan Sugalski
At 03:45 PM 2/7/2001 -0200, Branden wrote: >Dan, > >I think there is a real problem with your vtable approach. It involves >tying, overloading and assignment. I'm not sure if I really got what you >meant with the PDD, but I'm assuming: >1. PMC's replace SV*. Yes. >2. Tying is handled by vtables

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Peter Scott
At 05:07 PM 2/7/01 -0500, John Porter wrote: >Peter Scott wrote: > > Sorry, I wasn't clear. Let me rephrase. The 'try' helps me determine > that > > the following block is going to be subject to exception handlers which > will > > immediately follow as siblings of the block. > >O.k. That make

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Nicholas Clark
On Wed, Feb 07, 2001 at 04:30:24PM -0600, David L. Nicol wrote: > sub has_post_blocks{ > my $i = 3; > post { print "i ended up as $i"}; > my $arg1 = shift; $arg1 > 4 or die "arg1 ($arg1) too small"; > my $j = 2; > post {

POST blocks (like END, but in a sub or sub-like scope)

2001-02-07 Thread David L. Nicol
Nicholas Clark wrote: > > On Wed, Feb 07, 2001 at 04:30:24PM -0600, David L. Nicol wrote: > > > sub has_post_blocks{ > > my $i = 3; > > post { print "i ended up as $i"}; > > my $arg1 = shift; $arg1 > 4 or die "arg1 ($arg1) too small"; > >

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Peter Scott
At 02:17 PM 2/7/01 -0500, John Porter wrote: >Peter Scott wrote: > > > > I want the 'try' there for my sake, not Perl's; ... it > > helps alert me that the following block is subject to non-local control > > flow rules. > >Huh? Down that road lies the Java madness. > > eval { >

Re: assign to magic name-of-function variable instead of"return"

2001-02-07 Thread David L. Nicol
> Sorry, I wasn't clear. Let me rephrase. The 'try' helps me determine that > the following block is going to be subject to exception handlers which will > immediately follow as siblings of the block. Somewhat as I would look at > an if...elsif...else construct, it helps me put the block in c

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread John Porter
Peter Scott wrote: > Sorry, I wasn't clear. Let me rephrase. The 'try' helps me determine that > the following block is going to be subject to exception handlers which will > immediately follow as siblings of the block. O.k. That makes sense if some blocks can be try blocks (by adding the

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread David L. Nicol
John Porter wrote: > Note that END{} and BEGIN{} require no formal introduction. > You can put them anywhere you want, and they run at the proper time. > > Even continue{} is an implicit goto. And it requires no introduction > either. So if a post{} block could appear anywhere inside a block,

Re: yydestruct leaks

2001-02-07 Thread Alan Burlison
[EMAIL PROTECTED] wrote: > Hmm, so this is (kind of) akin to the regcomp fix - it is the "new" stuff > that is in yyl?val that should be free-d. And it is worse than that > as yyl?val is just the topmost the parser state, so if I understand correctly > it isn't only their current values, but also

Re: yydestruct leaks

2001-02-07 Thread nick
Alan Burlison <[EMAIL PROTECTED]> writes: >If an eval{} fails because of a snytax error, yydestroy is called on >leaving the eval scope. Unfortunately it does this: > >yyval = ysave->oldyyval; >yylval = ysave->oldyylval; > >So anything that is in those 2 vars that hasn't made i

Re: POST blocks (like END, but in a sub or sub-like scope)

2001-02-07 Thread David L. Nicol
Nicholas Clark wrote: > on the other hand, I'll argue the other side that > > { > my $flag > open FOO, " ... > } > post { > close FOO if $flag; > } > > is clearer because the tidy up doesn't visually get in the way of the flow > of what you're doing, and you can see what $flag is meant