[REBOL] Re: IS REBOL object oriented?
From: nitsch-lists:netcologne at: 6-Jun-2002 0:05
Am Mittwoch, 5. Juni 2002 22:14 schrieb Christopher Dicely:
> --- Abdel Belkasri <[belkasri--1stlegal--com]> wrote:
> > Anton,
> >
> > 1- Can I create my own custom object?
>
> Sure.
>
> foo: make object! [
> .
> .
> .
> ]
>
> That'll create an object. It works much like an
> object in a "real" OO language -- it can have
> data members, methods, etc. The big thing it misses
> compared to, say, C++ is you can't overload operators;
> it also only features single inheritance, but that's
> not so uncommon.
>
===overloading
if one codes like /view does, it works.
that means implement vtables by hand (easy),
and call the super-method by name.
like (pseudocode)
my-class: make super-class[
vtable: make vtable[
a-nice-tool: func[self arg1 arg2][
super-class/a-nice-tool self arg1 arg2
my-stuff self/var1 ..
]
]
var1: var2: none
]
my-object: make my-class[init-stuff]
my-object/vtable/a-nice-tool my-object ;pass self by hand
looks a bit ugly, but there are some kinds of semantic sugar possible.
mostly becuase it hides quick in dialects :)
===multiple inheritance
proto1: context[a1: b1: none]
proto2: context[a2: b2: none]
my-object: make make proto1 proto2 [my-var: none]
probe my-object
make object! [
a1: none
b1: none
a2: none
b2: none
my-var: none
]
> > 2- Can I run my legacy application written in C,
> > VC++, VB in the REBOL shell?
>
> AFAIK, yes, using /Pro or /Command, you can run
> arbitrary "native" programs from REBOL, either from
> a script or the console.
>
> With /Core or /View, no, you cannot.
>
-volker
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
no, i do netcologne.. ;)