Re: Syntax for Constructing new Objects (and classes?)

2007-04-05 Thread Alek Storm
On 4/4/07, Allison Randal [EMAIL PROTECTED] wrote: Alek Storm wrote: Whoops, that metaclasses reference didn't quite make sense (it was pretty late in my timezone). I meant that, in Smalltalk for example, classes are also first-class objects. Also, in prototype-based languages like Self

Re: Syntax for Constructing new Objects (and classes?)

2007-04-04 Thread Alek Storm
On 4/3/07, Alek Storm [EMAIL PROTECTED] wrote: we can just use set_hll_global and get_hll_global, storing the class PMCs like normal objects. Which makes sense, given that class PMCs can also *be* normal objects (metaclasses, etc), and we don't need a separate container for classes. My

Re: Syntax for Constructing new Objects (and classes?)

2007-04-04 Thread Allison Randal
Alek Storm wrote: Whoops, that metaclasses reference didn't quite make sense (it was pretty late in my timezone). I meant that, in Smalltalk for example, classes are also first-class objects. Also, in prototype-based languages like Self and ECMAScript, objects might also want to act like

Re: Syntax for Constructing new Objects (and classes?)

2007-04-03 Thread Allison Randal
Jonathan Worthington wrote: All that said, there is an argument for having it as a vtable method that I think stands, which is the same argument that suggests not having any methods on the class PMC at all and making everything a vtable method. The argument is that if a language wants to

Re: Syntax for Constructing new Objects (and classes?)

2007-04-03 Thread Jonathan Worthington
Alek Storm wrote: I've asked for something pretty darn close to what you've suggested (see #41619), but you've explained it a lot better than I ever could. Glad we're thinking similar things. What I think you were saying: Default |

Re: Syntax for Constructing new Objects (and classes?)

2007-04-03 Thread Allison Randal
Allison Randal wrote: Class is the base for all classes. I can see the value of stripping away any methods that may interfere with a particular HLL's concept of how a class should behave, so we'll do that. And what should we call the subclass of Class that adds lots of methody syntactic

Re: Syntax for Constructing new Objects (and classes?)

2007-04-03 Thread Alek Storm
Since classes are now a great deal more polymorphic, it seems we don't really need a newclass opcode anymore, since HLLs will instantiate the class objects themselves anyway. Instead of having $P0 = get_class HLLClass $P1 = $P0.new() Or: $P0 = get_hll_namespace $P1 = $P0.find_class(HLLClass)

Re: Syntax for Constructing new Objects (and classes?)

2007-04-02 Thread Leopold Toetsch
Am Montag, 2. April 2007 07:37 schrieb Joshua Isom: I'm not sure how the imcc compiler handles the .Foo syntax internally, but there's a file, runtime/parrot/include/pmctypes.pasm that at least appears as though it's magically included into the beginning of every pir/pasm file. Nope the

Re: Syntax for Constructing new Objects (and classes?)

2007-04-02 Thread Alek Storm
On 3/31/07, Allison Randal [EMAIL PROTECTED] wrote: Alek Storm wrote: $P0 = get_hll_namespace $P1 = $P0.find_class(HLLClass) $P2 = $P1.new() Will new() be a vtable method or PCCMETHOD in a Class PMC? That's the only way I can see this syntax not conflicting with normal method-calling

Re: Syntax for Constructing new Objects (and classes?)

2007-04-02 Thread Jonathan Worthington
Alek Storm wrote: I was expecting new() to be a vtable method, since that is the only way we can guarantee that whatever PMC comes out of find_class implements new(). We don't want code to crash because somebody stuck a non-class PMC into Parrot as a class. Huh? A vtable method doesn't

Re: Syntax for Constructing new Objects (and classes?)

2007-04-02 Thread Alek Storm
On 4/3/07, Jonathan Worthington [EMAIL PROTECTED] wrote: There is a compromise - make them all vtable methods, write a BaseClass PMC and inherit Class from it. BaseClass implements all of the vtable variants of the method, and Class can then provide a sane interface. HLL implementers who need

Re: Syntax for Constructing new Objects (and classes?)

2007-04-01 Thread Klaas-Jan Stol
Allison Randal wrote: Klaas-Jan Stol wrote: Hello, I have a short and simple question w.r.t. syntax for constructing new objects for the architect :-) Currently, it's done through: new P0, .Integer or in PIR: $P0 = new Integer # or .Integer I thought to have read somewhere this will be

Re: Syntax for Constructing new Objects (and classes?)

2007-04-01 Thread Allison Randal
Klaas-Jan Stol wrote: $P0 = get_class HLLClass $P1 = $P0.new() IIUC, instead of create a new object (either a built-in PMC or an OO object) in 1 instruction, it should now be done in 2? Yes. It adds a small amount of tedious typing, but gains us a great deal of power in our OO system. We

Re: Syntax for Constructing new Objects (and classes?)

2007-04-01 Thread Allison Randal
Allison Randal wrote: Or, can I also write: $P0 = Integer.new() # create new Integer PMC object $P1 = Hash.new()# create new Hash PMC object No, we're eliminating bareword class names from PIR/PASM entirely. It's easy to do that in an HLL, though. Unless, of course, you declare

Re: Syntax for Constructing new Objects (and classes?)

2007-03-31 Thread Allison Randal
Klaas-Jan Stol wrote: Hello, I have a short and simple question w.r.t. syntax for constructing new objects for the architect :-) Currently, it's done through: new P0, .Integer or in PIR: $P0 = new Integer # or .Integer I thought to have read somewhere this will be changed into something

Re: Syntax for Constructing new Objects (and classes?)

2007-03-31 Thread Alek Storm
$P0 = get_hll_namespace $P1 = $P0.find_class(HLLClass) $P2 = $P1.new() Will new() be a vtable method or PCCMETHOD in a Class PMC? That's the only way I can see this syntax not conflicting with normal method-calling syntax.

Re: Syntax for Constructing new Objects (and classes?)

2007-03-31 Thread Jonathan Worthington
Alek Storm wrote: $P0 = get_hll_namespace $P1 = $P0.find_class(HLLClass) $P2 = $P1.new() Will new() be a vtable method or PCCMETHOD in a Class PMC? It's implemented as a PCCMETHOD in the Class PMC, yes. Though at the moment you must write: $P2 = $P1.'new'() But that may well be a bug in

Re: Syntax for Constructing new Objects (and classes?)

2007-03-31 Thread Jonathan Worthington
Allison Randal wrote: No dot-prefix, but also no bareword class names. Only quoted names. Same is true for both high-level objects and low-level PMC objects. I guess the upshot of this is we need to deprecate the old syntax and make sure the new one works. Deprecate in the next release, remove

Re: Syntax for Constructing new Objects (and classes?)

2007-03-31 Thread Allison Randal
Alek Storm wrote: $P0 = get_hll_namespace $P1 = $P0.find_class(HLLClass) $P2 = $P1.new() Will new() be a vtable method or PCCMETHOD in a Class PMC? That's the only way I can see this syntax not conflicting with normal method-calling syntax. new() is a class method, an ordinary method on

Re: Syntax for Constructing new Objects (and classes?)

2007-03-31 Thread Alek Storm
Thank you, but I know what a PCCMETHOD is. On 3/31/07, Allison Randal [EMAIL PROTECTED] wrote: Alek Storm wrote: $P0 = get_hll_namespace $P1 = $P0.find_class(HLLClass) $P2 = $P1.new() Will new() be a vtable method or PCCMETHOD in a Class PMC? That's the only way I can see this syntax

Re: Syntax for Constructing new Objects (and classes?)

2007-03-31 Thread Allison Randal
Jonathan Worthington wrote: Allison Randal wrote: No dot-prefix, but also no bareword class names. Only quoted names. Same is true for both high-level objects and low-level PMC objects. I guess the upshot of this is we need to deprecate the old syntax and make sure the new one works. Deprecate

Re: Syntax for Constructing new Objects (and classes?)

2007-03-31 Thread chromatic
On Saturday 31 March 2007 12:42, Alek Storm wrote: $P0 = get_hll_namespace $P1 = $P0.find_class(HLLClass) $P2 = $P1.new() Will new() be a vtable method or PCCMETHOD in a Class PMC? That's the only way I can see this syntax not conflicting with normal method-calling syntax. I believe

Syntax for Constructing new Objects (and classes?)

2007-03-26 Thread Klaas-Jan Stol
Hello, I have a short and simple question w.r.t. syntax for constructing new objects for the architect :-) Currently, it's done through: new P0, .Integer or in PIR: $P0 = new Integer # or .Integer I thought to have read somewhere this will be changed into something like this: $P0 =