Rabid Dank Nutmeg
Last published: January 27, 2008 by 'mlucassmith'
Defines 0 Classes
Extends 4 Classes
A terrible package name, I know. But it caught your attention, huh?
It is an anagram for "bad argument kind", which is an error that you may have seen if you've done much DLLCC programming under VW. Two examples:
1) You have a function
If you pass a SmallInteger, or a Double, or a Float to this, the VM's DLLCC marshalling magic below primitive 395 will do the right thing. And it will do it faster and with less garbage than if you littered your code with asFloats. But if you pass it a Fraction or a ScaledDecimal, then it will blow up. We like Smalltalk transcendental numbers. We'd like to not have to worry about this. It may be slower, but it should work.
2) You have a function
Pass it a string, and all is good. But what if one of those UserMessages makes its way there? Should you have to put asString in front of every thing. Same problem as above, just another common example.
What this package does is put in place a special handler in the externalAccessFailedWith: code, which notes when the error is of this type, backs the stack back up to the method where things started, sends a recastAsCType: to the offending object, passing along the type, and then lets it try again. If multiple arguments are are encountered, it will repeat for each one.
There's probably a chance for infinite spin, I intend to fix that when I concoct a good test case. It works great for OpenGL and Cairo though.