Revised version of common/lib/anew.frt is below. Changes: - use new word FIND-XT - fix stack action for word-not-found case - add dependency on marker.frt for MARKER
\ POSSIBLY ( "name" -- ) \ Execute _name_ if it exists; otherwise, do nothing. \ Useful implementation factor of `ANEW`. \ ANEW ( "name" -- ) \ Compiler directive used in the form: `ANEW _name_`. \ If the word _name_ already exists, it and all \ subsequent words are forgotten from the current \ dictionary, and then a `MARKER` word _name_ is \ created that does nothing. This is usually placed \ at the start of a file. When the code is reloaded, \ any prior version is automatically pruned from the \ dictionary. \ \ Executing _name_ will also cause it to be forgotten, \ since it is a `MARKER` word. \ \ Useful implementation factor of `EMPTY`. #require marker.frt : possibly ( "name" -- ) parse-name find-xt if execute then ; : anew ( "name" -- ) >in @ possibly >in ! marker ; On Sat, Mar 5, 2016 at 4:24 PM, James Bowman <jam...@excamera.com> wrote: > Hello all, > > I am new to AmForth -- I am able to build run, and flash it on Arduinos, > and run the Python AmForth shell. > It's very nice to be able to run Forth on, so thanks very much. > > One question. I understand that if I want a word, for example ANEW, I do > this in the Python shell: > > #require anew.frt > > but in this case the definition of ANEW uses MARKER, so I must first do: > > #require marker.frt > > Is there a reason why anew.frt does not "#require marker.frt" itself? > Thanks. > > -- > James Bowman > http://www.excamera.com/ > > > -- James Bowman http://www.excamera.com/ ------------------------------------------------------------------------------ _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel