type checking

news.gmane.org mr.d.poon at gmail.com
Mon Sep 5 23:08:20 UTC 2005


FWIW, my approach is that if you pass the wrong arg in, and the method 
blows up consistently within the method, then you don't need to test the 
type - the amount of knowledge of the system required to debug these 
errors is minimal.  If however the method does not blow up immediately, 
but later you get a cryptic walk back in a seeminly unrelated bit of 
code, then it will be easier for the user's of your code if you put in 
some kind of check.

Dan

Kalecser Kurtz wrote:
> In smalltalk's dynamic typing aproach, do you think it's a good practice 
> to throw errors when the user try to use incompatible types?
> 
> For example:
> 
> - I create a class 'Mock' to mock general objects;
> - I create a class 'EntityMock' that is a Mock, but just to mock 
> Entities, once entities use doesNotUnderstand to resolve some of it's 
> methods;
> 
> So, if the user create a EntityMock with any other object than an entity 
> should the system warn him?
> 
> []'s Kalecser
> 
> -- 
> Tis the business of little minds to shrink,
> but he whose heart is firm, and whose conscience approves his conduct,
> will pursue his principles unto death.
> Thomas Paine
> 
> 
> ------------------------------------------------------------------------
> 
> 




More information about the Squeak-dev mailing list