[REBOL] Re: rebol weak points (i think)
From: g:santilli:tiscalinet:it at: 10-Sep-2000 12:50
Hello [rishi--picostar--com]!
On 09-Set-00, you wrote:
r> I've just started to play around with rebol. It definately has
r> it's = advantages for the beginner progammer but it seems
r> shows some weakness = for advanced, modular based programming.
r> For example, all user/system = defined variables are either
r> global (or local to a function). Since all = variables are
r> global in rebol and there is no way to associate a = variable
r> with a class, this would probably lead to collisions when you
r> = are using lot's of scripts.
Actually, this is not true. You can create as many contexts as you
like; think of a context as a "namespace", if you prefer. Also,
you should also realize that REBOL has no variables at all, but
only values.
Furthermore, the new upcoming MODULE! datatype will make REBOL
much more powerful that any other language with regards to
modularity.
r> Or let's say that the programmer of a utility script
r> reimplemented a = rebol defined function such as "print." Now
r> when you add his utility = script to your script, the function
r> print get's all screwed up in either = your script or his
r> script.
Have a look at:
my-object: make object! [
print: func ["my print" val] [
system/words/print val ; for example
]
]
r> Java and javascript have a much less chance of these
r> collisions since = the programmer can create static variable
r> and functions that are = associated with a class. These vars
r> and functions can be accessed = globally, but must have the
r> name of the class in front of the variable. = for example,
r> Math.pi
math: make object! [
pi: 3.1415926535 ;...
]
math/pi
r> could be a variable pi defined in class Math that can be
r> accessed = globally.it is not an instance variable, it is a
r> static variable. = Outside of the class Math, you have to use
r> "Math" before it in order to = access it.
It can be made "static", too, if you need to. For example, with:
math-statics: context [ ; the CONTEXT function is present in the
; latest experimental releases.
values: [3.1425926535] ; etc.
set 'math context [
pi: does [values/1]
]
]
math1: make math []
math1/pi
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/