Re: Methods and IMCC

2004-03-16 Thread Leopold Toetsch
Piers Cawley <[EMAIL PROTECTED]> wrote:

> So long as you can also do

> .meth_call "foo", PReturnContinuation

This is implemented already.

leo


Re: Methods and IMCC

2004-03-16 Thread Piers Cawley
Dan Sugalski <[EMAIL PROTECTED]> writes:

> At 9:49 AM +0100 3/12/04, Leopold Toetsch wrote:
>>Dan Sugalski wrote:
>>
>>>Calling a method:
>>>
>>>object.variable(pararms)
>>
>>Do we need the more explicit pcc_call syntax too:
>>
>>.pcc_begin
>>.arg x
>>.meth_call PObj, ("meth" | PMeth ) [, PReturnContinuation ]
>>.result r
>>.pcc_end
>
> Sure. Or we could make it:
>
> .pcc_begin
> .arg x
> .object y
> .meth_call "foo"
> .result r
> .pcc_end
>
> to make things simpler.

So long as you can also do 

.meth_call "foo", PReturnContinuation 



Re: Methods and IMCC

2004-03-13 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote:

> Sure. Or we could make it:

> .pcc_begin
> .arg x
> .object y
> .meth_call "foo"
> .result r
> .pcc_end

Done. modulo s/\.object/.invocant/

leo


Re: Methods and IMCC

2004-03-12 Thread Dan Sugalski
At 8:34 PM +0100 3/12/04, Leopold Toetsch wrote:
Dan Sugalski <[EMAIL PROTECTED]> wrote:
 ... (Though arguably
 anything you make a method call on really is an object :)
or a class.
Well... only because classes are objects. Or objects are classes. 
Possibly both, this OO stuff confuses me sometimes.
--
Dan

--"it's like this"---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk


Re: Methods and IMCC

2004-03-12 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote:
> ... (Though arguably
> anything you make a method call on really is an object :)

or a class.

leo


Re: Methods and IMCC

2004-03-12 Thread Dan Sugalski
At 9:57 AM -0800 3/12/04, Steve Fink wrote:
On Mar-12, Dan Sugalski wrote:
 At 9:49 AM +0100 3/12/04, Leopold Toetsch wrote:
 >Dan Sugalski wrote:
 >
 >>Calling a method:
 >>
 >>   object.variable(pararms)
 >
 >Do we need the more explicit pcc_call syntax too:
 >
 >   .pcc_begin
 >   .arg x
 >   .meth_call PObj, ("meth" | PMeth ) [, PReturnContinuation ]
 >   .result r
 >   .pcc_end
 Sure. Or we could make it:

.pcc_begin
.arg x
.object y
.meth_call "foo"
.result r
.pcc_end
 to make things simpler.
I vote yes -- until we add AST input to imcc, making the args and
invocant be line-oriented makes code generation easier for the Perl6
compiler, at least. (Although I might do it the 1st way anyway, just
because I spend so much time staring at generated code.)
But I had to stare at the ".object" for a second before I realized you
weren't just giving the type of another arg -- would it be better to
use ".invocant"?
I don't care either way. Invocant isn't bad as you can do this with 
non-object things, so object's not quite right. (Though arguably 
anything you make a method call on really is an object :)
--
Dan

--"it's like this"---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk


Re: Methods and IMCC

2004-03-12 Thread Steve Fink
On Mar-12, Dan Sugalski wrote:
> At 9:49 AM +0100 3/12/04, Leopold Toetsch wrote:
> >Dan Sugalski wrote:
> >
> >>Calling a method:
> >>
> >>   object.variable(pararms)
> >
> >Do we need the more explicit pcc_call syntax too:
> >
> >   .pcc_begin
> >   .arg x
> >   .meth_call PObj, ("meth" | PMeth ) [, PReturnContinuation ]
> >   .result r
> >   .pcc_end
> 
> Sure. Or we could make it:
> 
>.pcc_begin
>.arg x
>.object y
>.meth_call "foo"
>.result r
>.pcc_end
> 
> to make things simpler.

I vote yes -- until we add AST input to imcc, making the args and
invocant be line-oriented makes code generation easier for the Perl6
compiler, at least. (Although I might do it the 1st way anyway, just
because I spend so much time staring at generated code.)

But I had to stare at the ".object" for a second before I realized you
weren't just giving the type of another arg -- would it be better to
use ".invocant"?


Re: Methods and IMCC

2004-03-12 Thread Dan Sugalski
At 9:49 AM +0100 3/12/04, Leopold Toetsch wrote:
Dan Sugalski wrote:

Calling a method:

   object.variable(pararms)
Do we need the more explicit pcc_call syntax too:

   .pcc_begin
   .arg x
   .meth_call PObj, ("meth" | PMeth ) [, PReturnContinuation ]
   .result r
   .pcc_end
Sure. Or we could make it:

   .pcc_begin
   .arg x
   .object y
   .meth_call "foo"
   .result r
   .pcc_end
to make things simpler.
--
Dan
--"it's like this"---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk


Re: Methods and IMCC

2004-03-12 Thread Leopold Toetsch
Dan Sugalski wrote:

Calling a method:

   object.variable(pararms)
Do we need the more explicit pcc_call syntax too:

   .pcc_begin
   .arg x
   .meth_call PObj, ("meth" | PMeth ) [, PReturnContinuation ]
   .result r
   .pcc_end
leo



Re: Methods and IMCC

2004-03-11 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote:

> Method declarations:

> .pcc_sub foo prototyped, method
>.param pmc foo
>.param pmc bar

> .end

> That is, you add a method on the end of the sub declaration line. If
> you do so, the local self refers to the object pmc register.

Done.

  .namespace [ "Foo" ]
  .sub _meth method
  print "in meth\n"
  isa $I0, self, "Foo"
  ...

*If* a sub is declared as C, C is a valid identifier
refering to C.

leo


Re: Methods and IMCC

2004-03-11 Thread Dan Sugalski
At 2:15 PM +0100 3/11/04, Leopold Toetsch wrote:
Dan Sugalski <[EMAIL PROTECTED]> wrote:

 Calling a method:

 object.variable(pararms)

 object."literal name"(params)
Done.
Woohoo!
--
Dan
--"it's like this"---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk


Re: Methods and IMCC

2004-03-11 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote:

> Calling a method:

> object.variable(pararms)

> object."literal name"(params)

Done.

leo


Re: Methods and IMCC

2004-03-10 Thread Leopold Toetsch
Dan Sugalski <[EMAIL PROTECTED]> wrote:
> Time to nail down some method syntax for IMCC. So, what I'd like (and
> this is open to discussion) is:

> Calling a method:

> object.variable(pararms)

Ok.

> object."literal name"(params)

A currently already implemented variant is:

   object.label(params)

where label is an unquoted string. I'll do the other two variants
tomorrow, if they aren't done - seems simple now:)

> Method declarations:

> .pcc_sub foo prototyped, method
>.param pmc foo
>.param pmc bar

> .end

> That is, you add a method on the end of the sub declaration line. If
> you do so, the local self refers to the object pmc register. (I am OK
> with unconditionally doing this, in which case we should define some
> other guaranteed aliases)

alternative syntax:

  .self me   # declare PMC P2 as var me

so

  .pcc_sub foo prototyped, method

is

  .pcc_sub foo prototyped
  ...
  .self self

which is actually

  .local pmc self
  self := P2

leo


Methods and IMCC

2004-03-10 Thread Dan Sugalski
Time to nail down some method syntax for IMCC. So, what I'd like (and 
this is open to discussion) is:

Calling a method:

   object.variable(pararms)

   object."literal name"(params)

that is, if the method is referenced with a string register or .local 
you use the first form and just name the register or local. On the 
other hand, making a method call with an actual literal string you 
put the method in quotes.

Method declarations:

   .pcc_sub foo prototyped, method
  .param pmc foo
  .param pmc bar
   .end

That is, you add a method on the end of the sub declaration line. If 
you do so, the local self refers to the object pmc register. (I am OK 
with unconditionally doing this, in which case we should define some 
other guaranteed aliases)
--
Dan

--"it's like this"---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk