Re: Really auto autoloaded modules

2001-02-06 Thread Simon Cozens
On Mon, Feb 05, 2001 at 11:04:06PM -0500, Dan Sugalski wrote: > Granted, if this was all done with trusted servers it would be really neat, > but... TANSTAATS. -- I used to be disgusted, now I find I'm just amused. -- Elvis Costello

Re: PDD 2, vtables

2001-02-06 Thread Branden
Dan Sugalski wrote: > Okay, here's the VTABLE PDD. Comments, please. (As if there's any worry > about not having any :) Hi, Dan. I have a _very_ different view of yours on the vtable area. I read your PDD, but I really couldn't figure out how the operations would be carried. For instance, on

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

2001-02-06 Thread Branden
David L. Nicol wrote: > sub DirectBubbleSort(){ > my ($i,$t) = (-1,0); > while (++$i <= $#$__){ > $$__[$i] > $$__[1+$i] and $t++ and @$__[$i,1+$i] = @$__[1+$i,$i]; > }; > $t and @$__ = DirectBubbleSort; > } > > @SomeList = DirectBubbleSort; # instead of DirectBubbleSort(\@SomeList) > If I saw a m

Re: PDD 2, vtables

2001-02-06 Thread Tim Bunce
[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 -0500, Dan Sugalski wrote: > > =head2 Core datatypes > > For ease of use, we define the following semi-abstract data t

Re: Really auto autoloaded modules

2001-02-06 Thread Nicholas Clark
On Tue, Feb 06, 2001 at 12:49:28AM +0100, Bart Lateur wrote: > On Mon, 05 Feb 2001 11:35:59 -0500, Dan Sugalski wrote: > > >> > use autoload { Bar => 'http://www.cpan.org/modules/Bar' }, > >> > { Baz => 'ftp://my.local.domain/perl-modules/Baz', VERSION => > >>2 }; > >> > >>Very good

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

2001-02-06 Thread Branden
James Mastros wrote: > On Mon, Feb 05, 2001 at 08:43:02PM +0100, [EMAIL PROTECTED] wrote: > > On Mon, Feb 05, 2001 at 11:46:48AM -0500, James Mastros wrote: > > > By the time you get to the last line, you've already forgoten WTF you named > > > the return variable. > > Eh, I don't think that bad m

Re: a name for the currently executing sub

2001-02-06 Thread Nicholas Clark
On Mon, Feb 05, 2001 at 11:15:41PM -0500, Dan Sugalski wrote: > This isn't really what I'd consider a good thing, but raw memory access in > perl would be convenient. There'll probably be a special type of reference > that lets you do that. (Only needs a few changes to the vtable code, too) It'

Re: PDD 2, vtables

2001-02-06 Thread Branden
Tim Bunce wrote: > > =item move_to > > > >BOOL move_to(void *, PMC); > > > > Tells the PMC to move its contents to a block of memory starting at > > the passed address. Used by the garbage collector to compact memory, > > this call can return a false value if the move can't be done for some >

Re: PDD 2, vtables

2001-02-06 Thread Simon Cozens
On Tue, Feb 06, 2001 at 11:26:57AM +, Tim Bunce wrote: > > =item UTF-32 string > > =item Native string > > =item Foreign string > > I'm a little surprised not to see UTF-8 there, but since I'm also > confused about what Native string and Foreign string are I'll skip it. "Native string encodi

Another approach to vtables

2001-02-06 Thread Branden
I have some thoughts on vtables and I actually think they should be pretty different from what was proposed. Well, I'll tell you my ideas on vtables. Please note that I'm not doing this as an intent to confront the other proposal, or to create discordance and divergence. I'm presenting this becau

Re: PDD 2, vtables

2001-02-06 Thread Branden
Simon Cozens wrote: > > > =item logical_or > > > =item logical_and > > > =item logical_not > > > > Er, why not just use get_bool? > > Overloading. > Please see my previous post on the subject. As I pointed there, implementing || and && like that breaks short-circuits. - Branden

Re: Another approach to vtables

2001-02-06 Thread Simon Cozens
On Tue, Feb 06, 2001 at 11:30:12AM -0200, Branden wrote: > I actually have some more on it, but I'm saving it for the next postings. > I'll wait for your opinions first. I really hope to see critics about this. I don't understand what you think this gives us that the PDD doesn't. -- For me, UNI

Re: Really auto autoloaded modules

2001-02-06 Thread John Porter
Simon Cozens wrote: > > Whether it's a good idea or a bad idea is largely irrelevant; the > purpose of -language is to decide whether or not it should be possible. I think historically this has not been the case. But I suppose we could change the purpose of -language mid-stream... -- John Port

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

2001-02-06 Thread John Porter
[EMAIL PROTECTED] wrote: > > Hmmm. If there's such an "always" block, I'd like to see it on all blocks, > including the continue [1]. But then, it becomes hard to figure out to which > block the always belongs That's precisely why these things should be shoved inside rather than dangling off

Re: Really auto autoloaded modules

2001-02-06 Thread Dan Sugalski
At 08:44 AM 2/6/2001 +, Simon Cozens wrote: >On Mon, Feb 05, 2001 at 11:04:06PM -0500, Dan Sugalski wrote: > > Granted, if this was all done with trusted servers it would be really neat, > > but... > >TANSTAATS. Cute, but not entirely true. There are an awful lot of servers off the internet

Re: PDD 2, vtables

2001-02-06 Thread Dan Sugalski
At 11:32 AM 2/6/2001 -0200, Branden wrote: >Simon Cozens wrote: > > > > =item logical_or > > > > =item logical_and > > > > =item logical_not > > > > > > Er, why not just use get_bool? > > > > Overloading. > > > >Please see my previous post on the subject. As I pointed there, implementing >|| and &

Re: Another approach to vtables

2001-02-06 Thread Branden
Simon Cozens wrote: > On Tue, Feb 06, 2001 at 11:30:12AM -0200, Branden wrote: > > I actually have some more on it, but I'm saving it for the next postings. > > I'll wait for your opinions first. I really hope to see critics about this. > > I don't understand what you think this gives us that the

Re: Another approach to vtables

2001-02-06 Thread David Mitchell
> 2. Perl 5 doesn't separate well a `variable' from a `value', and this should > be done to achieve a more clear design. Perl5 does in fact make a clear separation. 'values' are SV structures (and AVs and HVs etc). Variables are names in stashes, PADs etc that have a pointer to an SV or whatever.

Re: Another approach to vtables

2001-02-06 Thread Dan Sugalski
At 01:50 PM 2/6/2001 -0200, Branden wrote: >Simon Cozens wrote: > > On Tue, Feb 06, 2001 at 11:30:12AM -0200, Branden wrote: > > > I actually have some more on it, but I'm saving it for the next >postings. > > > I'll wait for your opinions first. I really hope to see critics about >this. > > > > I

Re: Another approach to vtables

2001-02-06 Thread Branden
Simon Cozens wrote: > Well, hmm. That's true and it's not true. Consider how > $a = $b > works in Perl 5: the gvsv operations produce two SVs, one for the value of $a > and for the value of $b. Then the value of $b is assigned to the value of $a, > and $a is changed. No difference between lval

Re: Another approach to vtables

2001-02-06 Thread Simon Cozens
On Tue, Feb 06, 2001 at 02:32:16PM -0200, Branden wrote: > I noticed I couldn't get it to work. The thing is that $x = ... makes a > sv_setsv, what copies the value of the other SV (ST(0) in this case), but > not its magic, and other stuff. Here is the difference between `variable' > and `value'.

Re: Another approach to vtables

2001-02-06 Thread Dan Sugalski
At 02:32 PM 2/6/2001 -0200, Branden wrote: >I noticed I couldn't get it to work. The thing is that $x = ... makes a >sv_setsv, what copies the value of the other SV (ST(0) in this case), but >not its magic, and other stuff. Here is the difference between `variable' >and `value'. In Perl5, at least

Re: Another approach to vtables

2001-02-06 Thread Branden
David Mitchell wrote: > > 2. Perl 5 doesn't separate well a `variable' from a `value', and this should > > be done to achieve a more clear design. > > Perl5 does in fact make a clear separation. 'values' are SV structures > (and AVs and HVs etc). Variables are names in stashes, PADs etc > that hav

Re: Another approach to vtables

2001-02-06 Thread Dan Sugalski
At 03:53 PM 2/6/2001 +, David Mitchell wrote: > > 2. Perl 5 doesn't separate well a `variable' from a `value', and this > should > > be done to achieve a more clear design. > >Perl5 does in fact make a clear separation. 'values' are SV structures >(and AVs and HVs etc). Variables are names in

Re: Another approach to vtables

2001-02-06 Thread Simon Cozens
On Tue, Feb 06, 2001 at 03:53:09PM +, David Mitchell wrote: > Perl5 does in fact make a clear separation. 'values' are SV structures > (and AVs and HVs etc). Variables are names in stashes, PADs etc > that have a pointer to an SV or whatever. Well, hmm. That's true and it's not true. Consider

Re: Another approach to vtables

2001-02-06 Thread Branden
Dan Sugalski wrote: > At 03:53 PM 2/6/2001 +, David Mitchell wrote: > > > 2. Perl 5 doesn't separate well a `variable' from a `value', and this > > should > > > be done to achieve a more clear design. > > > >Perl5 does in fact make a clear separation. 'values' are SV structures > >(and AVs and

Re: PDD 2, vtables

2001-02-06 Thread Dan Sugalski
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 -0500, Dan Sugalski wrote: > > > > =head2 Core datatypes > > > > For ea

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

2001-02-06 Thread Garrett Goebel
From: Dan Sugalski [mailto:[EMAIL PROTECTED]] > > No, you attach the magic to a value. Perl just doesn't copy > magic when it copies data. Whether this is a good thing or > not is up in the air. (Half the time I want it to, the other > half I don't...) Is there a good discussion of magic, copyi

Re: Really auto autoloaded modules

2001-02-06 Thread Peter Scott
At 08:44 AM 2/6/01 +, Simon Cozens wrote: >On Mon, Feb 05, 2001 at 11:04:06PM -0500, Dan Sugalski wrote: > > Granted, if this was all done with trusted servers it would be really neat, > > but... > >TANSTAATS. Not even with the appropriate amount of PKI/X.509 hand-waving? -- Peter Scott Pac

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

2001-02-06 Thread Dan Sugalski
At 11:46 AM 2/6/2001 -0600, Garrett Goebel wrote: >From: Dan Sugalski [mailto:[EMAIL PROTECTED]] > > > > No, you attach the magic to a value. Perl just doesn't copy > > magic when it copies data. Whether this is a good thing or > > not is up in the air. (Half the time I want it to, the other > > h

Re: Another approach to vtables

2001-02-06 Thread Branden
Dan Sugalski wrote: > At 01:50 PM 2/6/2001 -0200, Branden wrote: > >In the approach using the vtables I propose, it would be: > > > > > > // get the PMC's that correspond to each variable... > > HVAR *foo = get_hvar("foo"); > > SVAR *baz = get_svar("baz"); > > AVAR *xyz = get_avar("xyzzy");

Re: Another approach to vtables

2001-02-06 Thread Branden
Dan Sugalski wrote: > At 02:32 PM 2/6/2001 -0200, Branden wrote: > >I noticed I couldn't get it to work. The thing is that $x = ... makes a > >sv_setsv, what copies the value of the other SV (ST(0) in this case), but > >not its magic, and other stuff. Here is the difference between `variable' > >a

Re: Another approach to vtables

2001-02-06 Thread Dan Sugalski
At 04:32 PM 2/6/2001 -0200, Branden wrote: >Dan Sugalski wrote: > > At 02:32 PM 2/6/2001 -0200, Branden wrote: > > >I noticed I couldn't get it to work. The thing is that $x = ... makes a > > >sv_setsv, what copies the value of the other SV (ST(0) in this case), but > > >not its magic, and other s

Re: Another approach to vtables

2001-02-06 Thread Branden
Dan Sugalski wrote: > >In a certain way, overloading is a way to attach magic to a value, in Perl5. > >I don't know how it's implemented, but if $a contains an object that has > >overloaded behaviour, and I do $b = $a, $b will contain a pointer to the > >same object, with the same overloaded behav

Re: PDD 2, vtables

2001-02-06 Thread Simon Cozens
On Tue, Feb 06, 2001 at 05:01:38PM -0200, Branden wrote: > How is a list currently (Perl5) implemented? It's a bunch of SVs sitting on the stack, followed by a mark. > Which operations does it support? None. -- Rule the Empire through force. -- Shogun Tokugawa

Re: PDD 2, vtables

2001-02-06 Thread Branden
Simon Cozens wrote: > On Tue, Feb 06, 2001 at 05:01:38PM -0200, Branden wrote: > > How is a list currently (Perl5) implemented? > > It's a bunch of SVs sitting on the stack, followed by a mark. > Where can I find how Perl5's stack works (specially about parameter passing and returning from subs)?

Re: Another approach to vtables

2001-02-06 Thread Simon Cozens
On Tue, Feb 06, 2001 at 04:23:06PM -0200, Branden wrote: > What's exactly a op dispatch? I _really_ don't know that. Please tell me so > that I can answer this... > ... > I know that (althought I don't have the exact definition of opcode yet). Oh boy. Look, Dan's been Good Cop, now it's my turn.

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

2001-02-06 Thread Garrett Goebel
From: Branden [mailto:[EMAIL PROTECTED]] > > try to define a method in package bar and try to call it > from $bar, like $bar->foo. Won't work either, you have > to ${$bar}->foo. Overloading should loose the magic > in the same sense that the method should not be called. No, $bar->asString and $b

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

2001-02-06 Thread Branden
Magic [Slightly Off-Topic... please point me to documentation]Garrett Goebel wrote: > I was recently bit by overloading magic in the Class::Context > generic constructor which the following code illustrates. If > you return "another" reference to a scalar which was blessed, > instead of the blesse

Re: Another approach to vtables

2001-02-06 Thread Branden
Sorry, I promess it's the last reply for today! Please don't rant on me! Dan Sugalski wrote: > At 04:23 PM 2/6/2001 -0200, Branden wrote: > >Dan Sugalski wrote: > > > Don't forget we have an opcode machine here--we are *not* emitting C code > > > to be compiled. That means we're going to be sto

Re: PDD 2, vtables

2001-02-06 Thread Simon Cozens
On Tue, Feb 06, 2001 at 05:21:03PM -0200, Branden wrote: > Where can I find how Perl5's stack works (specially about parameter passing > and returning from subs)? 4 steps: 1) Read the things I just mentioned. 2) Compile Perl with -DDEBUGGING, and run a very simple program with perl -Dts 3) Excha

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

2001-02-06 Thread Simon Cozens
On Tue, Feb 06, 2001 at 01:38:56PM -0600, Garrett Goebel wrote: > I'm sorry... I didn't mean to start an off-topic thread. This is currently being discussed on p5p, so you might want to take it over there. > Is there really no substantial documentation anywhere on magic? Not yet. This looks li

Re: PDD 2, vtables

2001-02-06 Thread Branden
Dan Sugalski wrote: > At 11:26 AM 2/6/2001 +, Tim Bunce wrote: > >Arrays and hashes should probably be at least mentioned here. > > And lists, yes. Or they need their own PDD with details. > What's the difference between array and list? How is a list currently (Perl5) implemented? Which opera

Re: Another approach to vtables

2001-02-06 Thread Dan Sugalski
At 04:23 PM 2/6/2001 -0200, Branden wrote: >Dan Sugalski wrote: > > At 01:50 PM 2/6/2001 -0200, Branden wrote: > > >In the approach using the vtables I propose, it would be: > > > > > > > > > // get the PMC's that correspond to each variable... > > > HVAR *foo = get_hvar("foo"); > > > SVAR *ba

Re: PDD 2, vtables

2001-02-06 Thread Dan Sugalski
At 05:01 PM 2/6/2001 -0200, Branden wrote: >Dan Sugalski wrote: > > At 11:26 AM 2/6/2001 +, Tim Bunce wrote: > > >Arrays and hashes should probably be at least mentioned here. > > > > And lists, yes. Or they need their own PDD with details. > > > >What's the difference between array and list?

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

2001-02-06 Thread Branden
Garrett Goebel wrote: > > > package bar; > > > @ISA = qw(foo); > > > sub new { bless \my $key; \$key } > > 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;

Re: Another approach to vtables

2001-02-06 Thread Dan Sugalski
At 05:41 PM 2/6/2001 -0200, Branden wrote: >Sorry, I promess it's the last reply for today! Please don't rant on me! I have not yet begun to rant. :) And I won't start, either. (And you certainly don't have to stop arguing your point. I don't claim to hold some sort of divine inspiration on in

Re: PDD 2, vtables

2001-02-06 Thread Alan Burlison
Branden wrote: > Where can I find how Perl5's stack works (specially about parameter passing > and returning from subs)? Oh boy. What a masochist. ;-) Alan Burlison

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

2001-02-06 Thread Tony Olekshy
John Porter wrote: > > [EMAIL PROTECTED] wrote: > > > > Hmmm. If there's such an "always" block, I'd like to see it on > > all blocks, including the continue [1]. But then, it becomes > > hard to figure out to which block the always belongs > > That's precisely why these things should be sho