[plt-scheme] Stack Object

From: Paulo Jorge O. C. Matos (pocm at mega.ist.utl.pt)
Date: Wed Oct 16 06:52:12 EDT 2002

Hi Anton,

Now I understand.
Thanks.

Best regards,

Paulo

Anton van Straaten wrote:
>>I'm not really aware with Java, but let me ask this: Why is print-name
>>not in the interface of the stack example?
> 
> 
> The point is that the interface may apply to objects other than "Stack".
> Objects belonging to any class which implements the interface can be called
> in the same way, without the caller necessarily knowing what kind of object
> it has.  All the caller needs to know is that the object supports the
> interface that the caller understands.
> 
> However, this doesn't stop the Stack object from defining public methods
> which are not part of a particular interface.  A caller which knows about
> Stack objects, and knows it has a reference to one, can call methods that
> are not on the interface.  A caller that is only aware of the interface, can
> only call methods on the interface.
> 
> If you want to write strict code that always uses interfaces to invoke
> methods, you can do so, but this is your choice: MzScheme doesn't require
> that you write code this way.
> 
> Anton
> 
> 


-- 
Paulo J. Matos : pocm(_at_)mega.ist.utl.pt
Instituto Superior Tecnico - Lisbon
Software & Computer Engineering - A.I.
  - > http://mega.ist.utl.pt/~pocm
  ---	
	Yes, God had a deadline...
		So, He wrote it all in Lisp!



Posted on the users mailing list.