# 3.0 changes 3.0 has many breaking and other qualify of life changes. Therefore some 2.0 macro codes will not work with 3.0 version of r4d. ## Library name changes Library name has changed from rad to **r4d**. This is due to a cargo recommenation(or say warning) to separate library and binary names. Previously the names were both rad. ## New rado binary for better experience New binary rado is now included in procects. Rado's goal is to provide easier way to edit and read macro files. You can edit a file as unprocessed form and read a file as a processed form. Refer [usage](./usage.md) for rado usage. ## Sensible comma parsing inside parenthesis Prevoiusly an argument parser interpreted any commas as delimter. From 3.0, it has changed into sensible default behaviour by ignoring them within pair of parenthesis. For example the following commands didn't work in 2.0. ``` $ifelse(true, $index(1,a,b,c) $index(2,a,b,c) ) === % This didn't work becuase ifelse thought '$index(1' was a second argument ``` To avoid this, explicit literal quote was required and yet it didn't work any better. For the release candidate stage, a new macro strip was added to circumvent this ( which is differnt from previous strip macro ). However to achieve general user's expectance, argument parser's logic has changed. Now the previous code will work without literal quote. ## Anonymous function Now you can define anonymous function that is used only for a scope which is handy for some cases such as one liner macro execution. ```bash cat test | rad --pipe -L '$mapl($anon(l=$cut(:,4,$l())$nl()),$-())' ``` ## "For" macro ergonomics This was already possible with "for\_macro" feature. From 3.0, for macros register a local macro named ```:``` which can be invoked with ```$:()```. Prevoiusly, for macro replaced $: string with iterated values, which worked pretty well but nested for loop was inconsistent. With newer implemenation, local macro ```:``` is executed according to local context thus enabling consistent nested loop. ``` $forloop^($:() - \*$forloop($:(),1,5)*\$nl(),1,5) === 1 - 12345 2 - 12345 3 - 12345 4 - 12345 5 - 12345 ``` ## Non-existent file input is an error Previously rad binary automatcially expanded input argument as literal text when the given input was not a valid file. Now this triggers an error and explicit flag ```--literal, -L``` is required to interpret argument as literal text. ## Error behaviours ( Nopanic flag removed ) Previously error levels were divided into strict,lenient,purge,nopanic. However logics in between was not consistent and made error logs unexpectable. From 3.0 nopanic flag is removed, and purge or lenient will prevent panics from both runtime and function macros. There are misc changes to error loggings and strict panics, ETC. ## Macro execution order Previously macro execution order was following, - Deterred - Local - Runtime - Function From 3.0, macro execution order follows new order - Local - Runtime - Deterred - Function So that user can easily override deterred macros if they want. ## Feature simplification Many features are now hidden from user, because those features were enabled by other features anyway while making docs harder to read. Some features such as csv or lipsum has been ditched in favor of other simpler crates or pure in-built implemenation. Storage has been merged to default r4d logic because it had very low overhead and made code maintenance hard with litle gain. There is also a possbility to add "hook" as default feature but it adds some overhead so not decidable at the moment. ## Storage method signature changed Previously storage accepted Vector of string, not it accepts array of string (&[String]) for better compatibility; ## Many breaking macro changes With 3.0, many macros' arguments order changed, some macros were removed and some macros names' were changed. The rationals are, - An argument that can highly contain commas should come the last for usability - Macro name that doesn't represent its behaviour should be changed to avoid confusion - Macros that are rarely used and are mostly a name "squtting" should be removed ## Misc There are also many miscellaneous changes. Such as - Many new macros - New rad feature - Detailed documentation - New library methods - Bug fixes