newPMC() (was: Re: PDD 2, vtables)

2001-02-21 Thread David Mitchell
Dan Sugalski wrote: Grab one via a utility function. getPMC() or something of the sort. newPMC() ? ;-) I think we shouldn't rule out the possibility of having multiple newPMC() style functions for grabbing PMCs used for different activities (eg lexicals vs tmps vs

Re: PDD 2, vtables

2001-02-18 Thread Alan Burlison
Dan Sugalski wrote: If PMC is a pointer to a structure, "new" will need to allocate memory for a new structure, and hence the value of mypmc will have to change. Nope. PMC structures will be parcelled out from arenas and not malloc'd, and they won't be freed and re-malloced much. If we're

Re: PDD 2, vtables

2001-02-18 Thread Dan Sugalski
At 12:45 AM 2/19/2001 +, Alan Burlison wrote: Dan Sugalski wrote: If PMC is a pointer to a structure, "new" will need to allocate memory for a new structure, and hence the value of mypmc will have to change. Nope. PMC structures will be parcelled out from arenas and not malloc'd,

Re: PDD 2, vtables

2001-02-18 Thread Alan Burlison
Dan Sugalski wrote: Grab one via a utility function. getPMC() or something of the sort. newPMC() ? ;-) Alan Burlison

Re: PDD 2, vtables

2001-02-18 Thread Dan Sugalski
At 01:13 AM 2/19/2001 +, Alan Burlison wrote: Dan Sugalski wrote: Grab one via a utility function. getPMC() or something of the sort. newPMC() ? ;-) Works for me. Though for some reason it brings up visions of the Village People, and that's generally a Bad Thing... :)

Re: PDD 2, vtables

2001-02-18 Thread Simon Cozens
On Sun, Feb 18, 2001 at 09:34:46PM -0500, Dan Sugalski wrote: At 01:13 AM 2/19/2001 +, Alan Burlison wrote: Dan Sugalski wrote: Grab one via a utility function. getPMC() or something of the sort. newPMC() ? ;-) Works for me. Slight that-sucks alert: So, if I have to get a new

Re: PDD 2, vtables

2001-02-18 Thread Dan Sugalski
At 02:50 AM 2/19/2001 +, Simon Cozens wrote: On Sun, Feb 18, 2001 at 09:34:46PM -0500, Dan Sugalski wrote: At 01:13 AM 2/19/2001 +, Alan Burlison wrote: Dan Sugalski wrote: Grab one via a utility function. getPMC() or something of the sort. newPMC() ? ;-) Works for me.

Re: PDD 2, vtables

2001-02-17 Thread Simon Cozens
On Mon, Feb 05, 2001 at 05:14:44PM -0500, Dan Sugalski wrote: =item new void new(PMC[, key]); Creates a new variable of the appropriate type out of the passed PMC, destroying the current contents if there are any. This is a class function. Can I suggest this becomes

Re: PDD 2, vtables

2001-02-17 Thread Simon Cozens
On Sat, Feb 17, 2001 at 02:34:08PM -0500, Dan Sugalski wrote: Well, the idea was that the passed in PMC is either reusable, can be trashed, or is an aggregate of some point and we may autoviv the element corresponding to the key. Right, OK, but how do we create them in the first place?

Re: PDD 2, vtables

2001-02-14 Thread David Mitchell
After a week's delay where I've just been too busy, I thought I'd resurrect the corpse of a thread I was involved in. First off, on Wed, 07 Feb 2001 14:37:33, Dan Sugalski [EMAIL PROTECTED] wrote: At 07:05 PM 2/7/2001 +, David Mitchell wrote: Dan, before I followup your reply to my

Re: PDD 2, vtables

2001-02-14 Thread Simon Cozens
On Wed, Feb 14, 2001 at 06:37:18PM +, David Mitchell wrote: Hmm, there doesnt seem to be anything related to handling constants in PDD 2. I anticipate constants will be PMCs with a small vtable of "get methods", possibly with several different types of value (string, numberic, float, etc.)

Re: PDD 2, vtables

2001-02-12 Thread Tim Bunce
On Fri, Feb 09, 2001 at 04:15:42PM -0500, Dan Sugalski wrote: On the other side, for a string that is matched against regexps, it doesn't matter much if it has variable character length, since regexps normally read all the string anyway, and indexing characters isn't much of a concern.

Re: PDD 2, vtables

2001-02-09 Thread Branden
Jarkko Hietaniemi wrote: Umm, one way or another I suspect UTF-8 will be in there. I suspect so too but very grudgingly. As Dan said dealing with variable length data is a major pain. UTF-8 is certainly a much better designed VLD than most but it's still a pain. I guess that's why

Re: PDD 2, vtables

2001-02-08 Thread Edwin Steiner
Dan Sugalski wrote: At 11:57 AM 2/8/2001 +0100, Edwin Steiner wrote: Dan Sugalski wrote: 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

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 think

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

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. Actually,

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? ++ and -- are

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 ease of use, we define the

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 of `key',

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

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. Hmmm,

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 whether

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. Actually, this

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 this

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 function???

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: 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 reason. The

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 encoding" is

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

PDD 2, vtables

2001-02-05 Thread Dan Sugalski
Okay, here's the VTABLE PDD. Comments, please. (As if there's any worry about not having any :) -Snip here-- =head1 TITLE Common vtable format for all variables =head1 VERSION =head2 CURRENT Maintainer: Dan Sugalski [EMAIL PROTECTED] Class: Internals PDD