> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 25, 2000 5:24 PM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Polymorphic

> I do like this kind of polymorphism. It can be observed only when
> using the prefix binary operators.
>
> OTOH, I think, that there is an even better way, how to arrange
> the things.

Hi, I don't like this kind of "polymorphism" (perhaps because being a C++
hacker) where knowledge about the types is spreaded to other functions. It
would be much cooler to add operator - to the make object! part of
complex!. Than whenever a - operator is used Rebol should see if one is
defined (wouldn't it be possible to define a function -?)

Like:

complex!: make object! [
    re: 0
    im: 0

    -: func[value1 [complex!] value2 [complex!]][
           return make complex! [
            re: value1/re - value2/re
            im: value1/im - value2/im
          ]
          ]
]

This would be really nice.

Robert M. Muench, Karlsruhe, Germany
    ==> ask for PGP public-key <==

  When do you want to reboot today?

Use the free portable GUI Library
OpenAmulet from http://www.openip.org

Reply via email to