Oforth Change Log

23/09/2018 : Oforth V1.2

Oforth V1.2 is released.

  • Added : Dual words. See manual (chapter 10 and 11)
  • Added : defer package and Defer words.
  • Added : Properties' attributes can now be mutable.
  • Added : Method is renamed Message.
  • Added : Implement is renamed Method.
  • Added : #perform is renamed #execute.
  • Removed : >digitOfBase and >charOfBase (>digit & >char work for all bases)
  • Fixed : Crash when a method was created with the same name as another word.
  • Fixed : Bug into readLineWith when data stack was empty.
  • Fixed : Map of a file that does not exists was not working properly.

07/05/2018 : Oforth V1.1

Oforth V1.1 is released.

  • Added : Support to MAC OS system
  • Added : File.of is now loaded at startup and the file package has been removed
  • Added : #sum, #zipWith, #zip added to words loaded at startup
  • Added : Allow to import: and use: multiple packages separated by ','
  • Added : LASTDEF renamed LAST-WORD and returns the last word created.
  • Added : #m: word added to create a method for the last delcared class.
  • Fixed : Fix crach when "( -- )" is used for a function without parameters.
  • Fixed : Into package quicksort, String>>sortWith : the result was not immutable

25/03/2018 : Oforth V1.0

Oforth V1.0 is now released.

  • Added : Oforth sources are now available for download
  • Added : Garbage collector is no more mandatory to desallocate memory (see "Memory management" chapter of the manual)
  • Added : Lots of changes...

20/12/2016 : Oforth V0.9.26

One more release is neeeded before V1.0. Many features have been stabilized and the Oforth manual is now available.

Changes are mainly internal

  • Added : The scheduler thread is removed and events (GC, ...) are handled by the main thread.
  • Added : Outer interpreter is now full written in Oforth (see asm.of and prelude.of if interested).
  • Added : Various optimizations.

24/09/2016 : Oforth V0.9.25

This version prepares Oforth V1.0 and is the last V0.9 version. Many features have been stabilized and the Oforth manual is now available.

Warning : this version is not fully compatible with previous Oforth sources and you some words have been tagged as obsolete :

  • obsolete : Commentaries begins now with \ . Old commentaries (//) are still supported, but will be removed in V1.0
  • removed : List and ListBuffer are now Array and ArrayBuffer. Because they are ... arrays...
  • Added : Deferred words.
  • Added : Oforth manual.
  • Added : New optional package : collect, with three collections : Hash, Set and Stack.

23/07/2016 : Oforth V0.9.24.1

  • Added : Minor optimizations on native code generator
  • Fixed : Minor bugs.

24/05/2016 : Oforth V0.9.24

3 main updates

  • Added : Native code generator is now written in Oforth
  • Added : FFI support (see documentation)
  • Added : In order to limit memory allocated at startup, some features are now available on separate packages and must be explicitly loaded. Those packages are : parallel, math, date, console, emitter, libc, os and tcp.

  • Fixed : Minor bugs.

04/02/2016 : Oforth V0.9.23

The main feature is Oforth compiler/interpreter written in Oforht itself.

Warning : this version is not fully compatible with previous Oforth sources : 1) The order to declare parameters (if any) has changed : they are now declared in the same order as they are on the parameter stack (and no more in the reverse order). If you declare parameters, declaration with more 1 parameter are wrong and should be changed. See tutorial 1 for more explainations. 2) { } are no more useable to declare words, they are dedicated to JSON objects. Classical Forth words : and ; and now mandatory. Sorry for those changes before the V1.0

  • Added : Two new files (asm.of and prelude.of) are now loaded at startup to define Oforth.
  • Added : Some new words have been added : see lang package documentation for details.

  • Fixed : Order of parameter declaration has been changed to conform to other stack languages (and Forth).

22/07/2015 : Oforth V0.9.21

  • Added : Packages are now loaded into their own namespaces.
  • Added : #use: added to load package into the system.
  • Added : #alias: on words to create word synonyms.
  • Added : #func: is now an alias of #:
  • Added : #-- is now an alias of #//
  • Added : #-- and #++ removed
  • Added : #-- is now a synonym of #//
  • Added : #seqEach to perform a runnable on integers without interval creation.
  • Fixed : Division by zero exception was not catchable.

26/09/2015 : Oforth V0.9.22

The main new feature is an incremental garbage collector.

Also, with this release, some oforth code has been included into namespaces to limit files loaded at startup. Dates, Emitters and Loggers have been removed from startup load and, if needed, should be loaded as packages (import: date or import: emitter or import: logger). If your code uses those features, importing those packages is now required.

  • Added : Garbage collector is now incremental.
  • Added : Classical Forth definitions are supported by the interpreter ( : f ... ; )
  • Added : --O command line option removes some runtime tests (stacks underflow/overflow, ...).

  • Fixed : #// bug when reading directly on stdin.
  • Fixed : On Linux OS, bug on #askln

22/07/2015 : Oforth V0.9.21

  • Added : Packages are now loaded into their own namespaces.
  • Added : #use: added to load package into the system.
  • Added : #alias: on words to create word synonyms.
  • Added : #func: is now an alias of #:
  • Added : #-- is now an alias of #//
  • Added : #-- and #++ removed
  • Added : #-- is now a synonym of #//
  • Added : #seqEach to perform a runnable on integers without interval creation.
  • Fixed : Division by zero exception was not catchable.

26/05/2015 : Oforth V0.9.20

Be careful : some changes made on this version may impact existing programs.
Major change is true value. New value is 1, previous value (-1) was not consistent with arbitrary precision integers.
If previous value (-1) was explicitly used, changes must be done to conform to new value in order to use this version.
Some other changes have been made : please check below.

  • Added : First version with Mac OS X support (minimum requirement is 10.6).
  • Added : true value is now 1 (old value was -1, but that was inconsistent with arbitrary precision integers).
  • Added : #: as a synonym of #func: to create function.
  • Added : #. to print the top of the stack
  • Added : #&== is replaced by #&=
  • Added : #&<> removed
  • Added : #rem is replaced by #mod and #divrem is replaced by #/mod
  • Added : SPACE constant is replaced by BL constant.
  • Added : #stripAll is added to Collection class and #stripChars has been removed.
  • Added : #maxFor and #minFor addded to Collection.

07/05/2015 : Oforth V0.9.19

  • Added : Oforth now handles integers of illimited size.
  • Added : Now #pow will handle integer exponents and #powf float exponants.
  • Added : #bitNot removed.
  • Added : New command line options --XT and --XM to adjust garbage collector behavior.
  • Added : --XTn : Garbale collector will run each n milliseconds (defaut is 120 ms).
  • Added : --XMn : Garbage collection will not run until n Ko of memory has been allocated (default is 1024 Ko).

07/04/2015 : Oforth V0.9.18

  • Added : Json class and Json serialize/deserialize as built-in. Interpreter now detects Json syntax.
  • Added : #isMultiple on Integer.
  • Added : #asStringOfBase(aBase) on Integer.
  • Added : #asList on Set.
  • Added : #<= on Collections and set Collection as Comparable.
  • Added : #mapIf(aTest, aRunnable) on Collections : map only elements that respond true to aTest.
  • Fixed : Integer parsing on some 32b architectures.
  • Fixed : #== operator : if an object could not be converted, an exception was raised instead of returning false
  • Fixed : #<< ref on Date : bad index for Date.Days
  • Fixed : #occurrences method name was misspelled (#occurences)

21/02/2015 : Oforth V0.9.17

  • Added : #init on ListBuffer to create ListBuffers from a runnable.
  • Added : #initValue on ListBuffer to create ListBuffers initialized with the same object n times.
  • Added : #del on indexables.
  • Added : Set collection added into /lang/collect
  • Added : #forEachNext for String to optimize utf8 operations.
  • Added : Method flush on Console in order to flush input.
  • Added : position and setPosition into File class to get and set position into the file
  • Added : Handle UTF8 file encoding.
  • Fixed : Bug into File>>readLine(n) at end of file.
  • Fixed : Bug into divrem when integers were greater than small integers.

31/01/2015 : Oforth V0.9.16

  • Added : Parallel model redesigned : now a task can be resumed on any idle worker, not just the one that created it.
  • Added : Parallel model redesigned : Schedulers have been removed (a least for now).
  • Added : New virtual method #doesNotUnderstand on Object.
  • Added : New method #value on Constants.
  • Added : New method #divrem on Integer.
  • Added : New method #eval on String.
  • Added : New class Pair into collections. Now, syntax [elem1, ..., elemn ] creates a pair if n value is 2.
  • Added : New method #occurences on collections.
  • Added : New methods #sort and #sortWith on Indexables (using quicksort).
  • Added : New methods #sub on Indexables.
  • Added : New function #zipAll to zip elements of multiple collections
  • Fixed : Error fixed when '{' was not following function definition on the same line.
  • Fixed : OFORTH_PATH now has ';' separator under Windows and ':' separator under Linux. INSTALL.TXT updated

01/12/2014 : Oforth V0.9.15

  • Added : Debug option command line --Dn is now ok (and default is no debug).
  • Added : --D1 option : now shows execution stack when exception is not catched.
  • Added : --D2 option : same as --D1 and allows to set break points using #.bp into a body. Tutorial updated.
  • Added : --Pstring option : perform string and leaves.
  • Added : New method #mapParallel on collections (into lang/Task.of).
  • Fixed : File>>size bug fixed into lang/File.of (wrong value was returned from stats list)
  • Other : For x86 processors, Pentium 4 is now the new minium requirement. Various optimizations. Bye bye 286...
  • Other : examples/BinaryTree.of updated to use #mapParallel

18/11/2014 : Oforth V0.9.14

  • Added : Linux 32bits x86 release.
  • Added : #rot & #tor functions for stack manipulation (see lang/Oforth.of" file)
  • Added : lang/Boolean.of file separated from lang/Object.of
  • Fixed : When exception was catched, exception variable was not set properly.
  • Other : Oforth files includes into lang package have now ".of" suffixe.

16/11/2014 : Oforth V0.9.13

  • Added : New function #.show that toggles between show or don't show stack after each command. Default is "don't show the stack".
  • Added : General exceptions into #interpreter now keep objects on the stack.
  • Fixed : #.w now shows #interpreter as main task as it should be.
  • Fixed : OFORTH_PATH directories muts now be separated with ':' instead of ';'
  • Various garbage collectr optimizations.

05/11/2014 - Oforth V0.9.12

  • First Oforth version

Some examples (from tutorials).

You can find lots of examples here

Factorial

: fact(n) n 0 == ifTrue: [ 1 ] else: [ n fact(n 1 -) * ] ;



Fibonacci sequence

: fib(n) 0 1 n #[ tuck + ] times drop ;



Look and say (see detail)

: lookAndSay(n) [ 1 ] #[ dup println group map([#size, #first]) ] times(n) ;



Sum of square roots of all even integers between 1 and 10000

seq(10000) filter(#isEven) map(#sqrt) sum println 333383.040171148



A ping pong between 2 tasks running concurrently and using channels to communicate

: pong(n, ch1, ch2) | i | n loop: i [ ch2 send(ch1 receive) drop ] ;

: pingpong(n)
| ch1 ch2 i |

   Channel new ->ch1
   Channel new ->ch2
   #[ pong(n, ch1, ch2) ] &
   n loop: i [ ch1 send(i) drop ch2 receive println ] ;



An emitter that launches event listeners into parallel tasks running concurrently

: myemitter {
| e |
   Emitter new(null) ->e
   e onEventParallel($foo, #[ "foo" println ])
   e emit($foo)
   e onEventParallel($foo, #[ "bar" println ])
   e emit($foo)
   e close ;