start | find | index | login or register | edit
Montag, 22. September 2003 link

>> a!: new prototype!
>> b!: new a!
>> b: new b!
>>
>> a!/defun foo func [ a b ] [ print a + b ]
== make hash! [foo: func [a b][print a + b]]
>> b/call foo [ 1 2 ]
3


gpoul 7730 days ago:
# bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
1+2
3
#


Bruno Bord 7730 days ago:
earl : all right. I read it, It looks like I understand what it does but :
a) I don't know which version of REBOL VM you are using to use prototype!
b) I really don't get the point. Defining a fonction for a! defines it for b! and thus for b... Is that Object Oriented Programming ? Rebol already does it. Huh ?

earl 7729 days ago:
it's a dump of test session of my very simple hack of a prototype-based programming addon to rebol. you can add functions to prototypes dynamically, and functions are properly inherited.

and no, rebol's object! has almost nothing to do with OOP.

a syntactically sugared version would look like

a!.foo: func [ a b ] [ a + b ]
b.foo 1 2


Please log in (you may want to register first) to post comments!

powered by vanilla
echo earlZstrainYat|tr ZY @.
earl.strain.at • esa3 • online for 8662 days • c'est un vanilla site