Re: [PROPOSAL] infix MMD operators

2005-04-13 Thread Leopold Toetsch
Leopold Toetsch wrote: If there are no objections, I'll continue with: 5) infix method signature change: METHOD PMC* add( [INTERP, SELF,] PMC* rhs, PMC ´*dest) { if (!dest) dest = pmc_new(INTERP, SELF->vtable->base_type); ... return dest; } If the destination PMC is passed in

Re: [PROPOSAL] infix MMD operators

2005-04-03 Thread Bob Rogers
From: Leopold Toetsch <[EMAIL PROTECTED]> Date: Fri, 1 Apr 2005 08:42:53 +0200 Bob Rogers <[EMAIL PROTECTED]> wrote: >From: Leopold Toetsch <[EMAIL PROTECTED]> > . . . >$ python >>>> 1+2j >(1+2j) > That is a good point, but subclassing isn't the only w

Re: [PROPOSAL] infix MMD operators

2005-03-31 Thread Leopold Toetsch
Bob Rogers <[EMAIL PROTECTED]> wrote: >From: Leopold Toetsch <[EMAIL PROTECTED]> > ..., since I assume an > Int+String=>Number method will exist that coerces the string to a number > first. I imagine you could do this by creating a subclass of Int, > e.g. LispInt, and then defining a LispInt+

Re: [PROPOSAL] infix MMD operators

2005-03-31 Thread Bob Rogers
From: Leopold Toetsch <[EMAIL PROTECTED]> Date: Thu, 31 Mar 2005 09:38:15 +0200 Bob Rogers <[EMAIL PROTECTED]> wrote: >From: Leopold Toetsch <[EMAIL PROTECTED]> >Date: Wed, 30 Mar 2005 08:57:55 +0200 > > ... , is that you are assuming (as I did not) that each and >

Re: [PROPOSAL] infix MMD operators

2005-03-31 Thread Leopold Toetsch
Bob Rogers <[EMAIL PROTECTED]> wrote: >From: Leopold Toetsch <[EMAIL PROTECTED]> >Date: Wed, 30 Mar 2005 08:57:55 +0200 > > ... , is that you are assuming (as I did not) that each and > every language built on top of Parrot will define its own PMC classes, > even for primitive arithmetic t

Re: [PROPOSAL] infix MMD operators

2005-03-30 Thread Bob Rogers
From: Leopold Toetsch <[EMAIL PROTECTED]> Date: Wed, 30 Mar 2005 08:57:55 +0200 Bob Rogers <[EMAIL PROTECTED]> wrote: > I guess I was hoping for access to a lower-level mechanism. FWIW, > Common Lisp is an example of a dynamic HLL that doesn't allow certain > ops to be overload

Re: [PROPOSAL] infix MMD operators

2005-03-29 Thread Leopold Toetsch
Bob Rogers <[EMAIL PROTECTED]> wrote: > I guess I was hoping for access to a lower-level mechanism. FWIW, > Common Lisp is an example of a dynamic HLL that doesn't allow certain > ops to be overloaded (at least not directly). Overloading is a syntactic construct that the compiler supports (or no

Re: [PROPOSAL] infix MMD operators

2005-03-29 Thread Bob Rogers
From: Leopold Toetsch <[EMAIL PROTECTED]> Date: Mon, 28 Mar 2005 11:27:58 +0200 Bob Rogers <[EMAIL PROTECTED]> wrote: > IMHO, one can have too much overloading. It seems cleaner to > distinguish between "+, the (sometimes overloaded) HLL operator" and > "add, the Parrot additio

Re: [PROPOSAL] infix MMD operators

2005-03-29 Thread Leopold Toetsch
Matt Fowles <[EMAIL PROTECTED]> wrote: > Leo~ > Why bother with the IS_NULL check if we have the "n_" variant already? > Why not have one option unconditionally use the destination pmc and > the other unconditionally create a new destination pmc? I think, we can just have one method with the sam

Re: [PROPOSAL] infix MMD operators

2005-03-28 Thread Matt Fowles
Leo~ On Mon, 28 Mar 2005 12:22:29 +0200, Leopold Toetsch <[EMAIL PROTECTED]> wrote: > Leopold Toetsch <[EMAIL PROTECTED]> wrote: > > > 5) infix method signature change: > > >METHOD PMC* add( [INTERP, SELF,] PMC* rhs, PMC ´*dest) { > > if (!dest) > > dest = pmc_new(INTERP, SELF-

Re: [PROPOSAL] infix MMD operators

2005-03-28 Thread Leopold Toetsch
Leopold Toetsch <[EMAIL PROTECTED]> wrote: > 5) infix method signature change: >METHOD PMC* add( [INTERP, SELF,] PMC* rhs, PMC ´*dest) { > if (!dest) > dest = pmc_new(INTERP, SELF->vtable->base_type); > ... > return dest; >} > If the destination PMC is passed in, i

Re: [PROPOSAL] infix MMD operators

2005-03-28 Thread Leopold Toetsch
Matt Fowles <[EMAIL PROTECTED]> wrote: > Leo~ > On Sun, 27 Mar 2005 16:37:41 +0200, Leopold Toetsch <[EMAIL PROTECTED]> wrote: >> 5) infix method signature change: >> >>METHOD PMC* add( [INTERP, SELF,] PMC* rhs, PMC ´*dest) { >> if (!dest) >> dest = pmc_new(INTERP, SELF->vtable->b

Re: [PROPOSAL] infix MMD operators

2005-03-28 Thread Leopold Toetsch
Bob Rogers <[EMAIL PROTECTED]> wrote: > IMHO, one can have too much overloading. It seems cleaner to > distinguish between "+, the (sometimes overloaded) HLL operator" and > "add, the Parrot addition operator" so that compiled code can opt out of > the overloading when the compiler knows that it

[PROPOSAL] infix MMD operators

2005-03-27 Thread Bob Rogers
From: Leopold Toetsch <[EMAIL PROTECTED]> Date: Sun, 27 Mar 2005 16:37:41 +0200 1) Mixed infix operations Opcodes that take one PMC and one native type argument, like: op add(in PMC, in PMC, in INT) should probably become plain vtable methods again. There isn't much "mu

Re: [PROPOSAL] infix MMD operators

2005-03-27 Thread Matt Fowles
Leo~ On Sun, 27 Mar 2005 16:37:41 +0200, Leopold Toetsch <[EMAIL PROTECTED]> wrote: > 5) infix method signature change: > >METHOD PMC* add( [INTERP, SELF,] PMC* rhs, PMC ´*dest) { > if (!dest) > dest = pmc_new(INTERP, SELF->vtable->base_type); > ... > return dest; >

[PROPOSAL] infix MMD operators

2005-03-27 Thread Leopold Toetsch
1) Mixed infix operations Opcodes that take one PMC and one native type argument, like: op add(in PMC, in PMC, in INT) should probably become plain vtable methods again. There isn't much "multi" in the dispatch as the dispatch degenerates to a search in the class of the left argument's MRO. OTO