POV-Ray : Newsgroups : povray.off-topic : Smalltalk become: : Re: Smalltalk become: Server Time
5 Sep 2024 11:24:14 EDT (-0400)
  Re: Smalltalk become:  
From: Orchid XP v8
Date: 1 Aug 2009 08:38:09
Message: <4a743731$1@news.povray.org>
>> Works great, as long as they're the same type. Try swapping an array of 
>> integers with a socket.
> 
>   Wouldn't it break the code which expects the object to be an array, but
> the object gets suddenly changed to something completely different?

One would presume so, yes. Depends what you decide to replace it with.

>   (What does Smalltalk do when an inexistent method is called? Runtime error?
> That's at least what happens in Objective-C, which is based on the same
> principles as Smalltalk, IIRC.)

Does calls #doesNotUnderstand:, which is a regular method. BY DEFAULT 
this throws an exception, but you can override it to do... whatever you 
want.

Darren's original article describes using it to load objects from disk 
the first time somebody tries to access them, for example.

I saw somebody else describe overriding it to implement multiple 
dispatch. (Smalltalk itself supports only single dispatch, like most OO 
languages.)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.