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

[REBOL] ANN: custom-types.r

From: g:santilli:tiscalinet:it at: 14-Mar-2003 10:30

Hello all, I decided to release an alpha version of custom-types.r. You can find it in: http://www.rebol.it/giesse/custom-types.r This version does not patch the global native actions; instead, it creates the ACTIONS* object with all the patched actions and sets the patched actions in the global context with a * suffix (i.e. PICK* etc.). To make a new type you just need to do: my-type!: make custom-type! [ ; you can place any data you require here actions [ ; you define the actions here ] ] You can see an example custom type in: http://www.rebol.it/giesse/complex.r Please note that custom-types.r requires subfunc.r from Ladislav. It just expects to find it in the same directory (along with tfunc.r that is required by subfunc.r). Also note that Ladislav's subfunc.r uses his function INCLUDE to call tfunc.r; you could get it too, or just replace the "include %tfunc.r" line in subfunc.r with "do %tfunc.r". On a side note, I've also uploaded: http://www.rebol.it/giesse/compile-rules.r it has a number of differences from the one previously described in my REP, and is not yet fully documented; it obsoletes dialect-framework.r, so if you were playing with it, you should probably try this new script. Here's a short note on the new PARSE commands: INTERPRET WITH <subrule> evaluate any control or iteration function (as well as function definitions and user defined functions). <subrule> is the rule applied to the blocks evaluated by the functions. IF <condition> <rule> condition has to be a paren!. If it results into true (actually, not none or false), rule is applied. EITHER <condition> <true-rule> <false-rule> condition has to be a paren!. Depending on the result of its evaluation, true-rule or false-rule is applied. DO <word> <rule> the next expression at the current position is evaluated (via DO/NEXT); rule is applied to the result (i.e. to a block containing the result as its first and only element), and if it matches the word is set to the result; if it does not match, an ERROR! is fired. THROW <message> <rule> rule is applied; if it matches, parsing continues normally; if it does not match, an ERROR! is fired using the supplied message (has to be a string). I hope to write a better doc for it soon; I will also update and submit my REP (I hoped to get more comments on it, tough...) to RT. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r