* Giuseppe Chillemi <[EMAIL PROTECTED]> [051107 06:00]: I have not been able to fully follow this thread, but from what I see, I would welcome anyone to think differently from the OOP approach.
For The Record: I program in python also, and objects are really the way to go with python, because it is designed that way. I've been also programming in C since I had hair (thats a *long* time), and also C++, but I think dynace is a better alternative to C++ http://www.algorithms.us/ Let me ramble a bit here, so I can gently lead us in another direction: Rebol was something called "words". A word is a rebol symbol that is delimited by whitespace, not quotation marks. You might think of a word as a *variable*, but that's not really correct. To better think about rebol words, consider the following console session, which is annotated by comments: >> blk: [a b c] ;; a block of words == [a b c] >> first blk ;; look at the first one == a >> get first blk ;; evaluate the first one ** Script Error: a has no value ** Near: get first blk >> a ;; evaluate a member by name ** Script Error: a has no value ** Near: a At this point we have words without values, that can only live inside of a block, but can be put to work for us in a more efficient way than dictionaries or objects. Now here is a little function that I whipped up, because what I use in productions has some dependencies: ;; code follows quotes: func[ "converts a block of words to a string with words delimited by commas" B "block of words to convert, but not evaluate" ][ res: copy "" append res form first B foreach member next B[ append res "," append res form member ] res ] ;; and here's a console session to illustrate >> record: [First_Name Middle_Name Last_Name] == [First_Name Middle_Name Last_Name] >> quotes record == "First_Name,Middle_Name,Last_Name" ;;Following are some code fragments and untested code, to ;; illustrate a mysql query and date retrieval in a rebolesque ;; manner ;; Let's use another rebol feature called a "dialect" selection-set: db[select (quotes record) from "mytable" where keyfield eq key] ;; this translates to something like ;; select First_Name,Middle_Name,Last_Name from "mytable" where ;; "keyfield"=123; ;; Now We have a selection set which is internally a block of blocks ;; and we can iterate thru it, setting the words from the original ;; 'record block with full confidence in referential integrity. foreach rec selection-set[ set record rec ;; now the words can "live" outside of the block ] ;; By referential integrity, I mean that the original 'First_Name word ;; will always be set to a value from the "First_Name" column from the ;; mysql table. Because I program in several languages, I find that the languages sort of inform each other, and give me insites that I might not otherwise have, but it is important to exploit the best features of the language. Now if it suits you, you can always convert 'record to an object I use a function called 'ctx for this, here's a quick example without (presumably) any dependencies, that illustrates how that works 0: blk repeat ndx length? X [ append blk reduce[to-set-word X/:ndx get vals/:ndx] ] obj: context O ;; now remember - code above is untested! ctx record => [First_Name: "Timothy" Middle_Name: "Noneyobizness" Last_Name: "Johnson"] My opinion: When in Rebol, think rebol, when in python, think python, when in smalltalk, think smalltalk; etc.... Further, in rebol, think about: words dialects scheme blocks It can be a tough transition, but take it from me, well worth the effort. MTCW Tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com -- To unsubscribe from the list, just send an email to lists at rebol.com with unsubscribe as the subject.
