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: 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: 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: 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 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: 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: 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: 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: 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: 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: 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: 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: 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