.class on Proc is not Proc. It's probably CardinalProc, but I haven't looked. Unsure how to go about this one. (Shows up in proc.t.)
This is also evident in range.t
Okay. I've done some research now. Took me some time because I had to fix a bug first to even try this. .class on a Proc is "Proc()", but only if you declare it as a proc. A bare proc (literal?) is a Sub, which has no .class.
A Range is coming across as CardinalRange, though. Unsure whether the better way to fix this is to simply rename the class, or get .class to lie.
1) hll_map Sub
2) Now that Cardinal is in its own .HLL, you should be able to get rid of all the crap CardinalFoo names, because no more namespace conflicts with core parrot types.
The last issue is that it'll be appending () to the names, which I think is solveable by adding to_s to the Metaclass that other metaclasses inherit from. Then having Object.class use that.
Okay, wow. hll_mapping Sub resulted in cardinal throwing sigbus for any attempt at execution. Did I do something particularly weird here?
diff --git a/src/classes/Proc.pir b/src/classes/Proc.pir
index 0073b1f..5034529 100644
@@ -20,9 +20,14 @@ Perform initializations and create the Proc class
.sub 'onload' :anon :init :load
- .local pmc cardinalmeta
+ .local pmc cardinalmeta, core_type, hll_type, interp
$P0 = get_hll_global ['CardinalObject'], '!CARDINALMETA'
cardinalmeta = $P0.'new_class'('Proc', 'parent'=>'CardinalObject', 'attr'=>'!block')
+ core_type = get_class 'Sub'
+ hll_type = get_class 'Proc'
+ interp = getinterp
+ interp.'hll_map'(core_type, hll_type)
.sub 'get_bool' :vtable
Could be that Proc doesn't actually subclass Sub, but it still shouldn't be crashing.
Issue #27 concerns a rewrite of Proc which should help with this.
Alright, so here's the updated status:
Waiting on #27 for the Proc rewrite.
Waiting on #34 for the s/CardinalFoo/Foo/
Waiting on #35 for the "Foo()" to "Foo" thing.
Once those are done, this issue can be closed.