On 5 May 2013 23:59, Max Leske <maxle...@gmail.com> wrote:
>
> On 05.05.2013, at 23:06, Igor Stasenko <siguc...@gmail.com> wrote:
>
>> On 5 May 2013 22:19, Max Leske <maxle...@gmail.com> wrote:
>>> Thanks Igor.
>>>
>>> I wonder if it would be possible instead to simply accept any object and 
>>> only use type checks in case of an error? In that case, extra cycles don't 
>>> matter. Or would an incompatible object crash the VM?
>>> I hope this doesn't seem like a dumb question, I'm just curious.
>>>
>> err.. im not sure i understand. You either do the type check or you
>> don't, and then get error
>> if you pass wrong object, or crash. There is no 3rd option :)
>
> Yes, that was the idea. Only with the thought of doing the type check for the 
> user. Something like this:
>
>         [ <perform call without typecheck> ] on: Error do: [ :e | (type 
> isKindOf: expected)
>                 ifTrue: [ NBCalloutFailed signal: 'expected…' ]
>                 ifFalse: [ e pass ] ].
>
> But that's only cool if possible without more VM crashes.
>
>> We can, however, introduce an option so you can turn strict type check 
>> on/off ,
>> or turn it off completely.
>
> That's a pretty cool idea actually. What about extending that idea:
> 1. replace current typecheck with an #isKindOf: check
> 2. add option to turn typecheck on / off.
>
> Then we'd have great feedback during development and would still be fast in 
> production by disabling the typecheck. What do you think?
>

I will add the option. But default will be same like now e.g. strict
obj class == class.


Btw, what stops you from implementing own marshaller with semantics you want?

In your case, make subclass of NBExternalObjectType, override methods there.
Then to make your code use new marshaller, if you use MyClass in
function signature e.g.:

nbCall: #(void foo( MyClass param) )

create a
MyClass class>>asNBExternalType: method,
which will answer an instance of your new marshaller.
(same what NBExternalObject does).

-- 
Best regards,
Igor Stasenko.

Reply via email to