overwriting <= operator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

overwriting <= operator

nelson -
hi all,
  can i overwrite the behaviour of <= operator for a squeak class? It seems I fail in doing it...

thanks,
  nelson


Reply | Threaded
Open this post in threaded view
|

Re: overwriting <= operator

Boris.Gaertner

"nelson -" <[hidden email]> wrote:
>
> hi all,
>   can i overwrite the behaviour of <= operator for a squeak class?
Yes, of course.
Look into the instance protocol of Number to see an example.
You can add the following method to any class:

<= anObject
   self halt.

When you add this to the instance protocol of Set,
you can evaluate

  Set new <= 5

and you will the the halt in the debugger.

> It seems
> I fail in doing it...
>

 
Greetings, Boris