[REBOL] Re: Is Rebol code smaler?
From: tim:johnsons-web at: 17-Nov-2002 13:32
* Rebolinth <[Rebolinth--nodep--dds--nl]> [021117 13:11]:
> Hiya All,
>
> Im wondering, when i roam through the codes from ie. the "Library"
> at reboltech or looking into example of rebol It amazes me again
> and again that I still see traces of "C". And im pointing out here
> the fact of "effective programming.
>
> I read once in the list (or a book) that someone said "First think befor you
> program when using rebol" and thats a fact. Still i see sometimes source
> codes popping by that are the size of an equal C program, I cant emagine
> that should be the cause ;-)
>
> Even when i look at examples from the RT themself i see purly C routines
> copied to Rebol (Take i.e. list-dir) Its an awful code, not even rebol-like!
Hmmm! Taking list-dir as an example: (I've programmed in "C" for 12 years)
It would take some overhead (including memory allocation) just to
get a list of files in a directory into a a char** array. Although
traversing the array could be just done using prefixed ++.
One could write a "C" that would look like rebol and be as compact
(but Hey isn't the rebol interpret written in Ansi C?), but a lot of
overhead would be applied to libraries somewhere.
But come to think of it, what's with
s: make string! 0
; insted of
s: copy "" ;?????
> So why is it? how come so? Rebol is language to me that should make code
> smaler!!! even 2x 3x smaler that original other languaes, but its not always!!
I've moved anything to I do that is not high-performance targeted to rebol
from "C". Believe me, I've saved a lot of code, not to mention ever larger
amounts of time in code maintenance and upload time and resources.
> I just build some routines in "TCL" that code is smaller then the Rebol-version
> (i've not finisched yet, still!!! im thinking twise befor coding a routine in
> Rebol, because I know it can be done effective and compact!!)
Also, in "C", you cannot "roll your own control structures", although the
preprocessor can enable you to sort of pretend to it a bit.
But, I believe that you can do so also in TCL, because control structures
and just functions just as is so in REBOL.
> The days of one-lines is long gone :-) But i take it with me when im
> programming! Make it small fast and compact (assembly freakoff:-)
There should be a rebol compiler or a system to translate rebol
code into an Ansi C "dialect", which could then be compiled.
> Anyway.. The question remains: Why isnt rebol code smaler?
>
> Anyone?
Grab the fire extinguisher!
Seriously, good to hear your input! :-)
-tim-
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com