ifTrue not acting as a polymorphic message?
First of all, hi to everybody. This is my first time posting to this list, and as the nettiquette rules says I introduce myself. I'm a student from the Universidad Nacional de Quilmes, in Quilmes, Buenos Aires, Argentina. So I beg for you to apologize my bad English. I'm currently the teachers assistent at Tecnicas Avanzadas de Programacion (Object Oriented Programming) Well, that's pretty much it. Second of all I would like to thank and congratulate the team behind Pharo. It's by far my favorite Smalltalk environment, although I miss some features from VisualWorks (Future discussion maybe :-) ) -------------------------------- Now, to my problem. While I was thinking on an exercise to give to the students I though about developing a three-valued logic, creating the TTrue, TFalse, and TUnknown, whos instances understood some methods such as #ifTrue: #ifFalse: and so on. My surprise came when I discovered that the ifTrue: method only work for the True and False instances of Smalltalk, being unable to define a method named ifTrue: For what I saw the problem is that, on non boolean receivers, the method is not even evaluated to see if the receiver can understand it, but it automatically triggers the message #mustBeBoolean So my question is, why does it do this? Is there a way to use ifTrue: really as a method? Is there a way that I can make ifTrue: to work with any Class and not just Booleans? Thanks in advance. -- Alan Rodas Bonjour
participants (1)
-
Alan Rodas