Introduction Ren-C Trello Notes License 1 1 IMPORTANT INFORMATION ABOUT BETA/ONE LOCK WHY REN-C? (click here and on cards for notes) 1 1 "Modify with Confidence" (The PARSE Trello is a separate board, but click here and on cards for some notes) WHERE TO GET IT. HOW TO BUILD IT. 3 <r3-legacy> - All Major Incompatible Changes from R3-Alpha selectively reversible (though no guarantees about being "error compatible") Comments ("invisibles") (click here and on cards for notes) COMMENT can be put anywhere, and not affect surrounding evaluation 2 ELIDE can invisibly evaluate an expression *almost* anywhere Vertical Bar | is an "Expression Barrier" which can be used to isolate evaluations 5 NIHIL is an "arity-0 comment", which can hold a place in an array without interfering with surrounding evaluation 1 Manipulate Evaluator Ordering With Usermode <| and |> END will terminate the processing of a BLOCK!/GROUP!, as if the end had been hit. Null (the "non-value unset!") (click here and on cards for notes) 1 SELECT and MAP/KEY operations distinguish mappings to BLANK! from absence of a mapping do [], PRINT and other actions signify their lack of a meaningful result using a VOID! value Passing null or blank to a refinement argument will "un-ask" for the refinement SOMETHING? NOTHING? nulls can be compared for equality or inequality REDUCE will raise an error if an expression evaluates to null 1 UNSET? and SET? test WORD!s or PATH!s to see if they represent set variables VALUE? tests a cell for if it contains a value (similar to old UNSET?) "Infix" Changes (click here and on cards for notes) 1 SET/ENFIX binds word to ACTION! so it gets 1st argument from the left 1 ENFIX operator (itself enfixed) for SET/ENFIX readability 1 PATH!s can be dispatched as infix, and provide refinements to infix operators using "SHOVE" (->) 1 Comparison operators like =, >, <, <> complete an expression evaluation on their left 1 ELSE operator provides generalized fallback clauses 2 THEN operator as ELSE complement, tests left for non-null ALSO is completely different (like THEN, but doesn't change the result) AND and OR are conditional -and- can be used for LOGIC!-driven branching 1 DEFAULT operator is now infix, and quotes a SET-WORD!, runs code 1 Enfixed functions can Quote their Left-Hand Arguments 1 Infix MAYBE operator only assigns a SET-WORD! if source isn't void or blank...REALLY variant fails vs. skipping the assign WAS operator evaluates to SET-WORD! or SET-PATH! value before an assignment, but also does the assignment 1 ME and MY operators replace ++ and -- by allowing a variable to update relative to itself 1 Infix UNLESS operator (more interesting than synonym for IF-NOT) SO is a postfix assertion operator, that can be less typing than ASSERT 1 Evaluation (click here and on cards for notes) 2 Source code is *immutable by default* 2 Variables holding LIT-WORD!s do not need :var to access as LIT-WORD! 1 FAIL native added to easily cause error!s, THROW will now reject them as a valid arg type DO only accepts arity-0 FUNCTION! (use new EVAL native for arity > 0) SEMIQUOTED? parameters are able to inform a function about whether the argument was evaluated at the callsite or provided literally. 1 Evaluate WORD! or PATH! using GET, REDUCE, or EVAL (not DO) LIT-WORD! quoted function arguments evaluate GROUP!s ("paren!s") before the function is called GET/SET of PATH! don't eval GROUP! (use REDUCE or EVAL) Conditionals Conditionals return null if no branch runs, and at *least* a BLANK! if a branch does run Branches may be BLOCK!s -or- ACTION!s with arity 0 or 1, which are passed the condition as an argument SWITCH will EVAL its match candidates (non-BLOCK!s), "fallout" of last match value replaces /DEFAULT 1 The last match candidate of a SWITCH "falls out" as the result if there is no corresponding block ANY and ALL don't allow VOID! (use ELIDE) Function Changes (click here and on cards for notes) There is only one kind of ANY-FUNCTION! (now known as ACTION!) *EPIC* => Definitional RETURN is *Solved*! 1 1 Refinements can take only 0 or 1 arguments, and an argument has the name of the refinement 1 *EPIC* FUNCTION provides unique identities for locals and args on each recursion 1 Tags in function spec <local>, <static>, <with>, and <in> replace and enhance refinements /WITH, /EXTERNAL from R3-Alpha *Extremely* Flexible VARARGS! variadic functions with <...> 3 Refinements aren't TRUE/NONE but REFINEMENT! or BLANK!, can be used to chain Tail-Call Optimization via REDO (and Sibling Tail-Call via REDO/OTHER) 2 APPLY can assign refinements and arguments by name, using a block of arbitrary code <end>able args replace the "unset quoting hack" (used to make HELP work with 1 or 0 args), allows infix functions to implement handling for prefix usages 1 UNWIND can dynamically trigger a return from any running FRAME! 1 No more EXIT: use RETURN with no arguments (same as RETURN VOID) 1 MAKE FUNCTION! treats SET-WORD! as a "pure local" (and you can use <local> followed by ordinary words for FUNC to translate them to pure locals for you) Function Generators (click here and on cards for notes) GET-PATH! partial specialization, e.g. APD: :APPEND/PART/DUP You can SPECIALIZE functions so some (or all) of their refinements or arguments are pre-filled 1 DOES invokes DO for STRING!/URL!/etc, can fully specialize any function, doesn't intercept RETURN 1 CHAIN for making a pipeline of functions that process each others results 1 ADAPT allows a function's implementation to be reused, with some pre-processing of its parameters ENCLOSE lets you modify a function's arguments, optionally run it, and derive from its result 1 HIJACK for causing another function to run in place of a previous one 1 Lambdas for defining functions such as `f: (x -> print x)` 1 Contexts and Functions may be annotated with a META context. Series Mechanics APPEND, INSERT, CHANGE will vaporize NULL additions REDUCE doesn't just reduce BLOCK! COMPOSE works on ANY-ARRAY!, /DEEP goes into ANY-PATH! COMPOSE treats ((double groups)) as splicing PRINT changes (click here and on cards for notes) PRINT auto-spaces by default, but does not space around CHAR!s. PRINT treats nulls as if they were not there at all PRINT only takes TEXT! (string) and BLOCK! DELIMIT with specializations SPACED and UNSPACED BINARY! is not PRINTed as a Rebol constant, rather interpreted as UTF8. 1 TO-STRING and FORM Use AS TEXT! to get the "delimiter-free" content of ANY-WORD! or ANY-STRING! To convert a UTF-8 encoded BINARY! to a string, use FORM and not TO-STRING PRINT X behaves equivalently to PRINT FORM X (hence PRINT of BINARY! will try and interpret as a UTF-8 string) Loops Loops return NULL if-and-only-if they BREAK (hence BREAK/RETURN is gone) CONTINUE added, as well as CONTINUE with result EVERY is a FOR-EACH variant that returns if all the loop body evaluations were truthy LOOP TRUE is an infinite loop, LOOP BLANK and LOOP FALSE don't loop at all COLLECT-WITH lets you specify an alternate name or alternate *variable binding* for the "keeper" function (vs. a solely-local KEEP) FOR-NEXT synonym for FORALL, add FOR-BACK, allow switching to any type of series. WHILE handles BREAK or CONTINUE in its body block only COUNT-UP and COUNT-DOWN offer simple 1 to N and N to 1 looping REPEAT with the data to be iterated as an ANY-SERIES! traverses it with NEXT, vs. acting like FOR-EACH FOREACH no longer captures series positions with SET-WORD! Renamings (click here and on cards for notes) DID, NOT, and TO-LOGIC replace TRUE? and FALSE? ALSO reclaimed and is no longer used for its old purpose...use ELIDE instead 2 #[NONE] is _, and NONE => BLANK (with NONE reserved for future use as NONE [a b c] => ALL [not a not b not c]) GROUP! is preferred term for the datatype formerly known as PAREN! (PAREN! remains as synonym) 1 ANY- prefix for SERIES!, NUMBER!, SCALAR! (type synonyms, latter preferred) LENGTH? SERIES => LENGTH OF SERIES TYPE? => TYPE OF 1 // => MOD, and MOD is now an infix synonym for MODULO CONTEXT-OF replaces BIND? and BOUND? AND, OR, XOR infix operators made "conditional"; AND*, OR+, XOR+ as bitwise replacements INDEX? => INDEX-OF, OFFSET? => OFFSET-OF, SIGN => SIGN-OF, ENCODING? => ENCODING-OF... ANY-BLOCK! => ANY-ARRAY! (type synonyms, latter preferred) ANY-TYPE => [<opt> ANY-VALUE!] STRING! => TEXT! Datatype Behavior (click here and on cards for notes) TO INTEGER! conversions of BINARY enhanced, and TO-INTEGER/UNSIGNED added 4 FIND cannot be used on Rebol3 MAP! as it can in Rebol2 1 Adding CHAR! to a BINARY! may add more than one byte (UTF-8 encoding of its codepoint), so use INTEGER!s Can't use Unicode Codepoints over U+FFFF 2 HASH! not supported, better substitute needed 1 Wildcard support via FIND/ANY and DELETE/ANY removed, better substitute needed TO LOGIC! treats 0 as TRUE (use NOT ZERO? to convert INTEGER! explicitly) 1 POKE into BITSET! only takes TRUE and FALSE LOGIC! (not 0 vs. nonzero integers or floating point numbers) URL! is left "as is" and not decoded by the scanner 1 THROWs and CATCHes (click here and on cards for notes) 1 The /NAME refinement of THROW can accept more value types (including FUNCTION! and OBJECT) QUIT returns no value by default to calling script CATCH without /NAME only catches throws that didn't use THROW/NAME There is no BREAK/RETURN, BREAK always makes loops return use CATCH and THROW QUIT/RETURN X => QUIT X TRAP with THEN replaces TRY/EXCEPT Files and PORT!s READ now defaults to BINARY! READ/STRING expects UTF8 input and not LATIN1 (may appear to not handle accented characters) GET-MODES using 'FULL-PATH replaced by CLEAN-PATH RENAME behaviour changed and now errors if %../file specified TO-LOCAL-FILE adds trailing slash if a folder Questionable Changes (Not everything R3-Alpha did necessarily will be kept in its current form...) ISSUE! is an ANY-WORD! instead of an ANY-STRING! ANY-STRING! cannot be aliased AS-BINARY, or vice-versa LOAD/NEXT removed in favor of TRANSCODE/NEXT REPEAT uses loop variable as internal state, changing it affects the iteration SWITCH uses EQUAL? / STRICT-EQUAL? for comparison MONEY! has more precision and smaller range than DECIMAL! (floating point), no currency code Uncategorized (click here and on cards for notes) COMPRESS/DECOMPRESS => GZIP/GUNZIP + INFLATE/DEFLATE 1 CHARSET! is case-insensitive when used with functions without a /CASE refinement PAIR! uses same precision as INTEGER! and DECIMAL! for its X and Y values Set operations (UNION, EXCLUDE, etc.) can work with any pair of ANY-STRING! or ANY-ARRAY! types 2 Encodings used by LOAD and SAVE are based on FUNCTION!s that can be either native or otherwise, allowing usermode "codecs" 1 MATCH filters values based on type tests, or arbitrary function filters 1 CHAR! is not signed and can't be COMPLEMENTed CHAR! subtraction returns INTEGER!, CHAR! addition produces higher codepoitns FOR loop status is in limbo IMAGE! opacity defaults to opaque, not transparent Trello Functionality Test 2 1 Objects "Multiple Inheritance" feature removed. NOTES - TEMPORARY New APPLY Name notes