Am Montag, 23. Oktober 2006 15:14 schrieb Patrick R. Michaud: > > .HLL 'pge', '' > > ... > > cl = newclass 'Exp' # ['pge'; 'Exp'] > > ... > > .namespace ['Exp'] # ['pge'; 'Exp'] > > ... > > scl = subclass 'Exp', ['Exp'; 'Closure'] # ['pge'; 'Exp'; 'Closure'] > > ... > > It's the ['Exp'; 'Closure'] that bothers me here -- I don't think > that a subclass should have to include the name of its parent in > the class name. It should be: > > scl = subclass 'Exp', 'Closure' # ['pge'; 'Closure']
I'm of course seeing your point, but the implementation differs. I'll try to summarize all the guts with more details: 1) a class hasa namespace This means that namespace names and class names are fully independent. 2) Above newclass/subclass actually are doing this: (with names abbreviated for line-length's sake) opcode / directive # Namespace Class --------------------------------------------------------------- .HLL 'p', '' # 'p' (or ['p']) --- (1) cl = newclass 'E' # ['p'; 'E'] 'E' scl = subclass 'E', ['E'; 'C'] # ['p'; 'E'; 'C'] ['E' 'C'] 3) when a class is created, the code in (2) tries to find a matching namespace in the current namespace then in the HLL namespace else a new namespace is created. 4) Summary - if you don't qualify the 'Closure' it just collides with the existing class of that name - that's it. (1) no effect (2) src/objects.c:577 ff leo
