Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Is Rebol code smaler?

From: greggirwin:mindspring at: 17-Nov-2002 22:01

Hi Norman, R> Im wondering, when i roam through the codes from ie. the "Library" R> at reboltech or looking into example of rebol It amazes me again R> and again that I still see traces of "C". REBOL is written by people in C. It makes some sense that, even though they are the ones who really know how to apply REBOL well, sometimes our mind goes down a certain path whether we want it to or not. :) R> Even when i look at examples from the RT themself i see purly C routines R> copied to Rebol (Take i.e. list-dir) Its an awful code, not even rebol-like! But it is easily understood. Mind you, I'm not saying that RT wrote it that way to serve as an example but would the following really be any better? (not that it's a great example) ; Larry Palmiter map: func [fn blk args /local result][ result: copy [] repeat el blk [append/only result fn :el args] return result ] ; Gabriele Santilli mk-string: func [len [integer!] ch [char! string!]][ head insert/dup make string! len ch len ] ; RT - modified by Gregg Irwin list-dir: func [ {Prints a multi-column sorted listing of a directory.} [catch] dir [any-type!] "Directory to list or nothing" /local max cols ][ dir: sort throw-on-error [either value? 'dir [read dir][read %.]] max: add 2 first maximum-of map :length? dir none forskip dir cols: add 1 to integer! (60 / max) [ repeat i cols [prin join dir/:i mk-string max - length? dir/:i " "] print "" ] print join length? head dir " files" ] Nobody's perfect, and here on the list you sometimes see genuine coding errors in mezzanines come to light. I'm guessing that LIST-DIR has been around a long time and, since it's working, nobody has messed with it. That said, you could cook up your own version and submit it to them for use in a future release. I imagine a lot of things are that way. I know I've written plenty of code with a deadline looming, and where the most important thing is to deliver something that works. People don't care (in general) how elegant or compact your code is. R> Anyway.. The question remains: Why isnt rebol code smaler? Sometimes it is. Look at how much power is packed into the LAYOUT function! Obviously not everything is so dense in the REBOL world, but does it need to be? Hopefully, when we find things - as you did with LIST-DIR - that could be improved and made more REBOLish, we'll make note of them and improve them. Even though REBOL isn't open source, RT seems very open to including mezzanine fixes and functions from the community. -- Gregg