newLISP® v.10.2.1 Release Notes rev 2010-03-17
This release introduces mutable objects in the FOOP object system and
some additions and changes to the API.
Note that the name change from name to term and the introduction
of the new functions ++, -- and extend can create
incompatibilities when running new code under older 10.0 and 10.1 based versions of newLISP
or when running older code under the new 10.2 version. For these cases, the release notes
show code tips, to make code run on the new and older versions.
Version 10.1.8 to 10.1.12 are versions leading up to version 10.2.0
Version 10.2.1 fixes a severe bug in setf and swap introduced in v.10.1.12.
Many thanks to all in the newLISP community who have contributed to this
release with advice, discussion and code.
Mutable objects in FOOP (Functional Object Oriented Programming)
- Previous versions passed the FOOP object as first parameter to a FOOP function. From
now on, the object is accessed via a self function:
(new Class 'Circle)
(context Circle)
(define (move dx dy) ; object not passed as parameter
(inc (self 1) dx) ; but accessed via: self
(inc (self 2) dy)) ; and mutable
(context MAIN)
(set 'myCircle (Circle 1 2 20))
(:move myCircle 3 4)
myCircle → (Circle 4 6 20)
The elimination of the object as the first passed parameter makes old FOOP
code imcompatible with new versions. At the same time code to change objects
is much easier to write in the new version, and execution speed is increased.
In old FOOP code only function definitions have to be changed by dropping
the first parameter (the target oject) and renaming all occurrences of it
in the function body to self. Function calls to FOOP functions
need not to be changed.
Other changes and additions
- New ++ and -- increment and decrement in integer mode.
To make new code using ++ work with older versions of newLISP,
put the following statement at the beginning of the file:
(when (< (sys-info -2) 10110)
(constant (global '++) inc)
(constant (global '-- ) dec))
- The functions dec and inc now always work in
floating point mode, regardless of the number of parameters. This could create
problems with code interfacing to C library functions. In case integers
have to be passed dec and inc should be converted
to ++ and --.
- The function crit-chi2 took (1.0 - alpha) probabilities
to calculate the critical Chi2. Now alpha should be passed as
probability parameter.
- A nil parameter in the delete functions enables
much faster namespace deletion without reference checking. This mode should
only be used when no references external to the namespace exist to symbols
inside that namespace. This is normally true for hash namespaces and object
systems which strictly limit direct access to namespace variables. Deleting
symbols or namespaces whose symbols are referenced externally will crash the
system.
- define-macro's (fexpr's) are now included in error reporting. Before
they would be reported as part of a define function which called it.
- In det and invert a new optional parameter controls
how zero pivot elements are handled in the LU decomposition algorithm .
When the optional Boolean parameter is not specified, the functions return
nil on singular matrices. The optional parameter specifies 0.0
(zero) or a very small number to continue calculation, as required for some
algorithms dealing with singular matrices.
- An additional and optional list-index in now can pick
an element of the result list.
- A new extend function allows destructive appends to lists
or strings. Usage of write or write-bufer and write-line
for string extension is discouraged. To make newer code using extend
run on older version of newLISP, insert the following statement at the beginning
of the program file:
; make new code working on older versions of newLISP
(when (< (sys-info -2) 10110)
(constant (global 'extend) write-buffer))
- In the find function the regex option can now be specified
as nil to do an offset-based search without regular expressions.
- The name function has been deprecated; use term
instead to extract the symbol name without the context prefix.
The boolean flag option, which was present in name, is not
present in term, use prefix to extract the prefix
context from a symbol.
The new term causes much less name clashes with user variables
than name did. To make new code using term work with oder
versions of newLISP, put the following statement at the beginning of the file:
; make new code working on older versions of newLISP
(when (< (sys-info -2) 10111)
(constant (global 'term) name))
- A new prefix function returns the context of a symbol passed
as parameter.
- The pretty-print function can take an additional
parameter to specify the default format string for printing floating point
numbers. This is useful when printing unformatted floating point numbers without
fractional parts, and these numbers should still be recognizabe as floating point
numbers.
- The deprecated use of $0 in ref, ref-all, set-ref
and set-ref-all has been removed. In set-ref and set-ref-all,
use only the anaphoric system variable $it to refer to the old contents.
ref and ref-all can take a true option to return
actual elements (formerly returned in $0) instead of index vectors.
The usage of the system variables $0 through $9 is
reserved for the case where regular expression matching is involved (with
few exceptions).
- read and write may be used as shorter writings of the
elementary I/O functions read-buffer and write-buffer.
- In starts-with and ends-with nil is not allowed
anymore as option for case insensivity. Use the regex option 1 instead:
; instead of
(starts-with foo bar nil)
; do
(starts-with foo bar 1)
This change will be compatible with previous versions of newLISP. But
older code will throw an error exception if specifying nil instead
of option 1 for case insensitivity.
The enviroment variable REQUEST_METHOD is now set by newLISP server mode
to one of the strings GET, HEAD, PUT, POST, DELETE
Changes and additions in external files
- Version 2.0 of GMP module file gmp.lsp fixes problems when using
64-bit newLISP.
- The SMTP module file smtpx.lsp has been replaced with a new
version 3.0 by Greg Slepak from http://taoeffect.com. The new version allows
for a custom port and does UTF-8 safe encoding.
- Cygwin is now supported again with makefile_cygwin and also
recognized by the configure utility. The makefile_cygwin
produces a newlisp.exe which can be placed into %NEWLISPDIR%
together with cygwin1.dll from the
Cygwin system.
The environment variable NEWLISPDIR is set after after installing
the Win32 version of newLISP and in most cases points to C:\Program files\newlisp
or the equivalent in other language locales than English. The functions
fork, spawn, sync, send and receive,
which do not work in the normal Win32 version, work on Cygwin compiled newLISP,
although slow.
Many thanks to Niek Albers from http://daansystems.com, for doing most of the work
of making complilation work on Cygwin again.
- The doc/INSTALL text file has an additional chapter for
customized install and for package creators.
- The editor syntax highlighting files in the util subdirectory of the
source distribution have been updated:
nanorc, newlisp.jsf, newlisp.vim
- The following standard module files needed to be updated to run on both
10.1 and 10.2 versions of newLISP:
canvas.lsp, ftp.lsp, gimp.lsp, postgres.lsp, sqlite3.lsp, stat.lsp, zlib.lsp
- The following utilities shipped with the source distribution and
published on http://newlisp.org have been updated to run on both
10.1 and 10.2 versions of newLISP:
newlispdoc, syntax.cgi, upload.cgi, xmlrpc.cgi
Bug fixes
- The Chi2 values calculated by crit-chi2 were too low for
odd numbers of degrees of freedom – the bayes-query function
was not affected by this.
- FOOP objects were not protected if held by a protected symbol.
- get-int did not do proper sign-extension in the 64-bit version
of newLISP.
- get-url now also handles error code 302 for re-location using the
location: header. In the past only codes 301 and 303 were handled for
automatic re-requesting with changed URI.
- new had a memory leak in certain applications of this function.
- The nil? predicate evaluated twice.
- The probabilities calculated by prob-chi2 were too low for
odd numbers of degrees of freedom.
- push on -1 (end of list) optimization was broken when copying
namespaces with new.
- When using push on uninitialized symbols, the element
pushed was returned instead of the new list created.
- The select function now throws an error message when overrunning
indexes.
- self now honours symbol protection, if the object passed is
held by a protected symbol.
- A fix for string stream writing in 64-bit newLISP.
- A messagebox pops up if a connection cannot be established between the
newLISP process and the Java GUI server on Win32.
- xml-parse now parses correctly UTF-8 characters.
∂