[REBOL] Re: The Rebol type system
From: joel:neely:fedex at: 7-Nov-2001 8:57
Hi, Maarten,
Maarten Koopmans wrote:
> Hi Joel,
>
> datatype! types (so I can make op2! types).
> op! types
>
Yes, I'd sure like to have a MAKE OP! option. One might imagine
that it would require a two-argument function (which could be
checked at definition time) and create a new binary operator
so that
hypotenuse: make op! function [x [number!] y [number!]] [
square-root x * x + (y * y)
]
would allow one subsequently to write
z: 3 hypotenuse 4
I have no idea how hard this would be for RT, but it appears that
the lexical part of the work is already done...
>> alias '* "times"
== times
>> 3 times 4
== 12
> the next 500 types I can find a use for.
>
> Yes there are languages that allow you this that I use sometimes:
> - Haskell
> - Objective Caml (a ML dialect)
>
Right! I was expecting to see some thing in the Haskell/ML arena.
(Hardly garden-variety, J. Random Programmer languages, though!)
I wonder if there are enough bits in the type field to support very
many additions... (ONLY KIDDING! ;-)
-jn-
--
This sentence contradicts itself -- no actually it doesn't.
-- Doug Hofstadter
joel<dot>neely<at>fedex<dot>com