[Pharo-project] [NativeBoost] little improvement

Igor Stasenko siguctua at gmail.com
Mon Mar 19 12:13:11 EDT 2012

Actually, my plans were to report the actual position for argument, or
even its name.

This code:

asm jmp: gen failedLabel.  <----- change to: gen failWithCode:
NBPrimErrBadArgument .

will be replaces with something like:

gen failWithMessage: self coercionErrorMessage

And produced coercionErrorMessage can be quite descriptive, like..

if you having function

void foo (int x)

and you call it with wrong type (say float)

it could say:

"Coercion failed: a callout argument #1 should be an Integer"

.. or something like that.

This will require adding the 'position' ivar to NBExternalType class,
so then it can produce such descriptive error messages.

Or, well...
since we don't know what is the purpose of this.. generator should
decide by itself..

So, i would add a new protocol to generator, like:

gen failCoercionFor: self
( where self is an instance of NBExternalType)
then external type don't needs to know its own position (generator
knows it already).

Best regards,
Igor Stasenko.

More information about the Pharo-dev mailing list