"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "q-7.11/NEWS" of archive q-7.11.tar.gz:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1
2 "QNEWS"
3 =======
4
5 * 7.11 23 February 2008
6
7 - As suggested by Rob Hubbard and John Cowan, special Unicode characters in
8 strings can now be specified using an escape of the form '\&name;', where
9 name is any of the XML entity names specified here:
10 http://www.w3.org/TR/2007/WD-xml-entity-names-20071214/
11
12 - clib now provides a set of additional int/float vector operations, as
13 suggested by John Cowan on the mailing list a while ago. These allow you to
14 treat byte strings as mutable C vectors of signed/unsigned 8/16/32 bit
15 integers or float/double values. Operations to convert between such C
16 vectors and corresponding lists of integers/floating point values are
17 provided as well.
18
19 - The glob and regex functions were moved back from system into clib. Also, a
20 bug in the await function function was fixed (now it properly accepts
21 timeouts specified in seconds, not millisecs), and support for mutex and
22 semaphore timeouts was added to the try function (this requires a system
23 with pthread_mutex_timedlock/sem_timedwait).
24
25 - Added support for highres timers (clock_gettime et al) on systems where the
26 POSIX timer extension is available. The system module provides a number of
27 new functions (nanotime, nanosleep, etc.) to deal with these. Moreover, the
28 builtin time function will now also make use of clock_gettime/gettimeofday
29 if they are available.
30
31 - Worked around some quirks with the MS Access ODBC driver which caused it to
32 reject NULL and empty string parameter values in SQL insert statements.
33 (Bug reported by Jiri Spitz.) The odbc_examp.q script now also works with MS
34 Access on Windows. Moreover, as suggested by Tim Haynes, there are a couple
35 of new functions to retrieve additional metadata about a data source.
36
37 - Jiri Spitz also contributed a much improved AVL tree implementation for the
38 container types (bag.q, dict.q, hdict.q, set.q). The improved algorithm has
39 its origin in the SWI-Prolog implementation of association lists by
40 R.A.O'Keefe and Jan Wielemaker (see assoc.pl at http://www.swi-prolog.org).
41 Jiri rewrote the algorithm in Q and also added the deletion operations
42 which were missing in the Prolog version. Tests indicate that updating the
43 new data structures is at least twice as fast for large trees, quite a
44 notable improvement!
45
46 Thanks to all who contributed code and participated in the discussions leading
47 up to this release!
48
49
50 ------------------------------------------------------------------------------
51
52 * 7.10 17 December 2007
53
54 Another bugfix release which fixes some bugs in the clib module, see the
55 ChangeLog for details.
56
57
58 ------------------------------------------------------------------------------
59
60 * 7.9 8 December 2007
61
62 A bugfix release. Please see the ChangeLog for details.
63
64
65 ------------------------------------------------------------------------------
66
67 * 7.8 15 October 2007
68
69 This release fixes some critical and a lot of smaller bugs in the interpreter,
70 and also adds some important new features. The most important user-visible
71 changes are listed below. As usual, please check the ChangeLog for details.
72
73 IMPORTANT BUGFIXES:
74
75 - Left-hand side 'where' clauses now work as advertized. In Q 7.7, these would
76 sometimes cause the bytecode compiler to generate wrong code for free
77 variables on the right-hand side of an equation. (Reported by Eddie Rucker.)
78
79 - Fixed a couple of rather obscure bugs in the bytecode compiler related to
80 wrapping around at end-of-file, which caused segfaults under certain
81 circumstances. (Reported by Eddie Rucker.) This also fixes a long-standing
82 bug which caused the parser to "wrap over" with an unfinished construct at
83 the end of an imported module; this now properly provokes an error message.
84
85 - Shell escapes ('! command') work again. These apparently stopped working at
86 some time in Q <= 7.7 due to changes in the command lexer.
87
88 NEW FEATURES:
89
90 - Qualified (a.k.a. selective) import clauses, as suggested by John Cowan. In
91 addition to the old-style "unqualified" import clauses ('import module' or
92 'include module'), which import the entire namespace of the given module
93 into the client module, Q now also supports "qualified" imports using the
94 following syntax:
95
96 from module import name1, name2, ...;
97 from module include name1, name2, ...;
98
99 This has the effect of declaring the given symbols in the current namespace
100 *without* importing the module itself. Thus the imported symbol 'name' is to
101 be accessed as just 'name' or 'client::name' (where 'client' is the
102 importing module's name) instead of 'module::name'. (You can also use *both*
103 qualified and unqualified imports in concert to make both 'client::name' and
104 'module::name' work.
105
106 The difference between 'from module import' and 'from module include' is
107 that the latter also reexports the symbols by making them 'public'. This
108 works similar to unqualified includes, but note that with qualified includes
109 the symbols really become part of the namespace of the client module.
110
111 For convenience you can also write
112
113 from module import;
114 from module include;
115
116 without listing any symbols to just import/include everything. (It goes
117 without saying that this should be used with care.) Again, this is roughly
118 equivalent to 'import module' or 'include module', respectively, but the
119 imported symbols are redeclared in the namespace of the client, without
120 importing or including the module itself.
121
122 In order to better support the new clauses, the symbol declaration rules
123 are slightly more strict now to ensure proper diagnostics if different
124 symbols with the same print name are accidentally imported from different
125 sources. (Please see the documentation or the ChangeLog for details on
126 this.)
127
128 - Slim prelude. Following a discussion about namespace pollution and startup
129 times on the mailing list, the prelude was modified in order to reduce both.
130 Specifically, stdtypes.q and its parts (array.q, bag.q, etc.), as well as
131 getopt.q are *not* included in the prelude any more, and most of the POSIX
132 system interface has been unbundled from clib.q and moved to the new
133 system.q module which also needs to be imported explicitly. (But note that
134 clib.q still offers all the really essential stuff, namely C replacement
135 ops, additional string/gmp functions, a few high-level file I/O functions
136 including printf/scanf and friends, byte strings, references, multithreading
137 support and, last but not least, the 'exit' function. These are considered
138 so ubiquitous in Q programming and/or fundamental enough that they are
139 retained in the prelude.)
140
141 As a result, interpreter startup with the slim prelude is now more than
142 twice as fast, and the global (builtin+prelude) namespace is much leaner now
143 (395 versus 1068 symbols). This hopefully makes the interpreter easier to
144 use, especially on older or embedded hardware. But note that this also
145 breaks backward compatibility, as you will now have to import getopt.q,
146 system.q and stdtypes.q (or its parts) in scripts which need the system
147 operations and the container data structures. You're kindly asked to check
148 your scripts by running them through the compiler with the -w option to find
149 out whether they might be affected. :)
150
151 - Extended tuple and string operations. Enumerations and comprehensions now
152 also work with tuples, using the same kind of syntactic sugar. Moreover, the
153 tuple operations in stdlib.q have been moved to the new tuple.q module and a
154 few additional list operations (cat, map, do and friends, reverse) have been
155 extended to also work with tuples. Similarly, the remaining string functions
156 from stdlib.q have been moved to the string.q module, and this module now
157 also overloads *all* the common list operations from stdlib.q so that they
158 work on strings as expected. (This was already suggested by Alexander
159 Nickolsky a while ago.)
160
161 - Mutable sequences. Based on one of John Cowan's proposals on the mailing
162 list, I've implemented some convenience operations to work with tuples,
163 lists, streams and other containers of references. These can be found in the
164 new reftypes.q module (needs to be imported explicitly). Please note that
165 this module is still experimental. Bug reports and comments are appreciated.
166
167 - New 'whois' command. This is an improved version of the 'whos' command which
168 also lists, for each given symbol, the fully qualified names under which the
169 symbol is available in the global namespace. Moreover, the 'whos' command
170 was modified to list available alternatives instead of just printing an
171 error message for ambiguous unqualified symbols, and to also report the line
172 numbers where each symbol is declared or first used.
173
174 - Improved warning messages. At long last, the '-w' option now reports the
175 proper line numbers in undeclared symbol warnings. The --pedantic option now
176 also warns about non-prelude symbols from unqualified imports which are used
177 without proper qualification. This is useful to report a common source of
178 errors, namely the accidental "reuse" of an unqualified symbol due to a
179 missing local symbol declaration. Moreover, the undocumented warning level 3
180 is now officially available using the '--paranoid' option. In addition to
181 '--pedantic', it also warns about undeclared free variables and unqualified
182 imports even from the prelude. Note that '--paranoid' produces an excessive
183 amount of diagnostics even with perfectly sound scripts, so its use is not
184 really recommended, but it may occasionally be useful to check your script
185 for missing declarations or mistyped identifiers. Last but not least, the
186 new QWARN environment variable can now be used to set a default warning
187 level.
188
189 - Both interpreter and bytecode compiler now accept '-' as the main script,
190 causing the script to be read from standard input. This is great for testing
191 purposes, and can also be combined with "here" documents to embed Q programs
192 in ordinary shell scripts.
193
194 DOCUMENTATION AND EXAMPLES:
195
196 - Of course, the manual has been updated to describe all the new features, and
197 I have also greatly expanded Appendix B.4, "Running Scripts from the Shell",
198 which now describes in much more depth and with examples how Q scripts can
199 be configured to run as standalone programs. Also see the section on
200 expression references in the "Clib" chapter for a description of the new
201 reftypes.q module.
202
203 - Thanks are due to Eddie Rucker for contributing various examples to the
204 wiki. The latest version of his comma-separated values example (csv.q) is
205 now included in the distribution.
206
207 PACKAGING:
208
209 - On Linux systems, the "all in one" package now also includes the new ncurses
210 and Qt/Q interfaces, as well as all the available multimedia examples, the
211 Pd plugin and the faust2pd and faust2sc scripts, which were previously
212 provided as separate packages.
213
214 - At the time of this writing, the ncurses and Qt/Q modules as well as the
215 Pd/Q plugin haven't been ported to Windows yet. They will hopefully be
216 provided in the near future. Please check the Q website or the Q mailing
217 list for corresponding announcements.
218
219 - Also note that most of the addon modules had to be updated for the new Q
220 release, so if you install Q from source, make sure that you reinstall the
221 latest versions of your addon packages as well.
222
223
224 ------------------------------------------------------------------------------
225
226 * 7.7 11 June 2007
227
228 This release marks another important milestone with quite a few notable
229 changes, mostly in response to various discussions, suggestions and feature
230 requests from the Q mailing list. Special thanks are due to John Cowan, Rob
231 Hubbard, Marco Maggesi, Alexander Nickolsky and Eddie Rucker for testing and
232 bug reports, and to Rob Hubbard for providing the latest versions of his
233 rational and polynomial libraries.
234
235 The present release is also intended as a preview for the forthcoming "stable"
236 8.0 release. The only major missing feature right now appears to be the
237 support for 64 bit systems, but this will (hopefully) be fixed before the 8.0
238 release.
239
240 The most important changes in this release, which also coincide with the most
241 popular feature requests, are:
242
243 - user-defined operator symbols consisting of multiple punctuation symbols,
244 such as (--);
245
246 - a new kind of left-hand qualifiers which can be shared among different
247 equations (thus you can now have conditions and local variable definitions
248 spanning multiple equations for the same left-hand side);
249
250 - a full implementation of Wadler-style "views", which extends the "custom
251 unparsing" mechanism already available in previous releases, so that you can
252 now also use these custom representations in pattern matching.
253
254 Besides this, the latest "all-in-one" package also comes with new and improved
255 versions for many of the addon modules, and now also includes the latest
256 version of Rob Hubbard's polynomial library "QiX".
257
258 Below is a more detailed list of all important changes and additions in the
259 core distribution.
260
261 - Various bugfixes, see the ChangeLog for details.
262
263 - Various cleanups in the core distribution. In particular, we removed the
264 bundled glob, regex and readline libraries which were ancient versions and
265 didn't support unicode; we now use the available system libraries instead.
266 We also removed the bundled gqbuilder and gnocl interface, as well as mod_q
267 and the qcwrap utility; these will be made available as separate source
268 packages. As a result, the core package is much leaner now, it also builds
269 much faster and 'make distcheck' finally works.
270
271 - -w2 a.k.a. --pedantic doesn't print undeclared variable warnings any
272 longer. These warnings were a major annoyance since they forced you to
273 declare variables used inside lambdas, list comprehensions and similar
274 constructs. (For the time being, there is a new -w3 option which still
275 allows you to print those warnings if you can't live without them.)
276
277 - There's a new --cstacksize option and corresponding 'cstacksize' command
278 which allows you to set the maximum C stack size to be used by the internal
279 eval() routine. This allows you to catch C stack overflows which could
280 occur during the evaluation of non-tail-recursive special forms, as reported
281 by Eddie Rucker. The 'cstacksize' value is given in KB; the default is
282 256. If 'cstacksize' is set to zero then these checks are disabled.
283
284 - The Q bytecode compiler, qc, has a new option -d a.k.a. --debug which causes
285 a listing of the generated bytecode to be printed on standard output. Both
286 the QVM instructions generated for the right-hand sides of equations and the
287 matching automaton for the left-hand sides is printed. Please note that this
288 option is only available if qc is invoked directly.
289
290 - Uncapitalized identifiers created dynamically at runtime are now treated as
291 function symbols (unless they are explicitly declared as variables using a
292 'var' declaration, which is now also available on the command line). The
293 previous behaviour was to treat *all* symbols created at runtime as
294 variables, which, as pointed out by Alexander Nickolsky, was inconsistent
295 with the script language and therefore confusing.
296
297 - There's a new syntax for qualifiers ('if' and 'where' clauses) which allows
298 qualifiers to be shared by different equations for the same left-hand side.
299 The new kind of qualifiers is written on the left-hand side of an equation,
300 like so:
301
302 fact N if N>0: = N*fact (N-1);
303 otherwise: = 1;
304
305 The lhs qualifiers work exactly like the "old-style" qualifiers which are
306 written on the right-hand side, at the end of an equation, but while the
307 latter are always confined to a single equation, the former have a scope
308 which extends up to the next equation with either another lhs qualifier or
309 an explicit left-hand side. Conditions and local variable bindings are then
310 shared between all equations in the scope of the qualifier. Of course, lhs
311 and rhs qualifiers can be mixed freely. For instance:
312
313 strip C S
314 where N = #S-1 if not null S:
315 = strip C $ sub S 0 (N-1) if S!N = C;
316 = strip C $ sub S 1 N if S!0 = C;
317 otherwise:
318 = S;
319
320 Here, the scope of the condition 'not null S' and the local definition 'N =
321 #S-1' encompasses the first two equations.
322
323 - It is now possible to declare operators which consist of multiple
324 punctuation symbols, such as:
325
326 public (--) Xs Ys @(-);
327 Xs:List--Ys:List = foldl (flip (filter . neq)) Xs Ys;
328
329 To make this work it was necessary to change some of the lexical rules of
330 the Q language, and so this is not 100% backward-compatible. Nevertheless,
331 most existing scripts should work with no or minimal changes. Please refer
332 to the manual for details.
333
334 - Wadler-style "views" are now supported, which allow you to match against
335 "virtual" constructors, using the existing customizable unparsing
336 mechanism. This is particularly useful to provide pattern-matching
337 capabilities on abstract data types which have their real constructors
338 hidden, such as the 'Rational' type (and now also 'Complex', see below) as
339 well as the container data types from the standard library. See the new
340 section on "views" in the manual for details. (Note that previous Q versions
341 since 7.2 already had a kind of "custom unparsing" mechanism on which the
342 views implementation builds and which it supersedes. In fact, views still
343 work for defining custom pretty-printing rules, the only difference is that
344 the "unparsing" function is now called 'view' instead of 'unparse'.)
345
346 - 'Complex' is now an abstract data type, very much like 'Rational'. The
347 virtual constructor is (+:); (:+) is provided as an alias for Haskell
348 aficionados. This is also used as the canonical view for 'Complex'. E.g.,
349 the imaginary unit 'i' will now be printed as '0+:1'.
350
351 - 'lambda' is now a virtual constructor for the builtin 'Function' type, and
352 there's a builtin rule for 'view' which unparses 'Function' objects as
353 'lambda' terms. This lets you match against compiled lambdas without having
354 to play dirty tricks with valq . str, and makes the runtime compilation of
355 lambdas mostly transparent to the programmer. E.g., the following will now
356 work as expected:
357
358 ==> var fact = \N.if N>0 then N*fact(N-1) else 1; fact
359 \X1 . if X1>0 then X1*fact (X1-1) else 1
360
361 ==> def \PAT.BODY = fact; PAT; BODY
362 X1
363 if X1>0 then X1*fact (X1-1) else 1
364
365 - External types with an associated view will now use the view to compare
366 objects of the type for syntactic equality, using the same "equal if they
367 print out the same" rule which also applies to ordinary expressions. This
368 applies, in particular, to the builtin 'Function' type (see above). Semantic
369 equality (=) on 'Function' objects is now undefined (used to be syntactic
370 equality, but that is now already provided by (==)).
371
372 - The builtin special form (==), which checks two expressions for syntactic
373 equality and is also used internally by the QVM to implement non-linear
374 rules, is now directly accessible in Q scripts. We also added a
375 corresponding (!=) operator, which is just the negation of (==), to the
376 prelude.
377
378 - We added a new '_FAIL_' builtin, suggested by Alexander Nickolsky, which
379 makes an entire reduction fail (as opposed to 'fail' which only aborts the
380 current rule).
381
382 - Clib now provides a basic interface to the readline library. See clib.q or
383 the manual for details.
384
385 - The standard library function 'cat' now works with an arbitrary mixture of
386 lists and streams and will always return a list. This is necessary to ensure
387 consistent behaviour of list and stream comprehensions with mixed arguments.
388 Note that this implies that 'cat' is now always strict and won't work with
389 infinite streams any more, so you have to use 'streamcat' for lazy stream
390 concatenation instead.
391
392 - The pattern-matching conditional 'case' is now an instance of 'Lambda', to
393 make rebindings in nested scopes work properly. The 'matchp' helper function
394 was removed and replaced by direct invokations of the 'eq true.(\X.true)'
395 idiom for the same reason. As a bonus, cond.q now defines two additional
396 special forms 'condfun' and 'casefun' which allow you to construct anonymous
397 conditional and pattern-matching functions which take their data in
398 a second parameter.
399
400 - Lots of updates and improvements in the manual. Updates for the new features
401 in this release can be found, in particular, in the sections on lexical
402 syntax in chapter 3, declarations in chapter 5, user-defined operators in
403 chapter 6, equations and qualifier syntax in chapter 7, views in chapter 8,
404 special constructors and streams in chapter 9, lambda abstractions in
405 chapter 10, and complex numbers in chapter 11. Some material in these
406 sections has also been rewritten to better explain some of the more arcane
407 features of the Q language.
408
409
410 ------------------------------------------------------------------------------
411
412 * 7.6 18 December 2006
413
414 Another maintenance release. Fixes issues with temporary files being created
415 in the wrong directory on Windows, and bugs in custom unparsing and shebang
416 handling. Also adds some OSX compatibility patches (thanks to Andrew Berg) and
417 renewed support for OpenZaurus 3.5.4.
418
419
420 ------------------------------------------------------------------------------
421
422 * 7.5 12 September 2006
423
424 Another bugfix release. Fixes various segfaults in libq and libqint.
425
426
427 ------------------------------------------------------------------------------
428
429 * 7.4 30 August 2006
430
431 Another bugfix release. This one fixes a memory allocation bug and missing
432 unresolved forward (-w) warnings in the compiler.
433
434
435 ------------------------------------------------------------------------------
436
437 * 7.3 21 August 2006
438
439 This release fixes a critical bug related to the new memoization feature
440 introduced in Q 7.1, which could cause random expressions to remain
441 unevaluated. Some other bugs in the bytecode compiler and the interpreter were
442 also fixed (see the ChangeLog for details). In particular, left-hand sides of
443 equations may now contain const values in the head, provided that they are
444 followed by extra arguments.
445
446
447 ------------------------------------------------------------------------------
448
449 * 7.2 27 June 2006
450
451 This release sports a major revision of Q's "numeric tower". There is a new
452 abstract type `Real' which is a subtype of `Num' and the new supertype of both
453 `Int' and `Float'. Rob Hubbard's rational number type has been integrated into
454 the standard library, and the `complex.q' module has been overhauled to turn
455 complex numbers into an algebraic type. Moreover, as suggested by John Cowan,
456 the floating point arithmetic has been fixed to properly support IEEE INFs and
457 NaNs, and `typec.q' now includes some additional Scheme-like "semantic"
458 type-checking predicates which allow you to classify numbers according to the
459 abstract kind of value they represent (complex, real, rational, integer),
460 rather than the concrete data type they belong to. Please note that, due to
461 the necessary changes in the floating point arithmetic, division by (exact or
462 inexact) zeros does not fail any more, but returns an inf, -inf or nan value,
463 depending on the numerator.
464
465 To support user-defined pretty-printing, there is an experimental new hook
466 into the expression printer, which lets you define custom unparsings for any
467 built-in, user-defined or external data type, by just adding definitions for
468 the new (predefined) `unparse' function. Examples for this can be found in the
469 prelude.q script.
470
471 As usual, please refer to the ChangeLog and the manual for the details.
472
473 ACKNOWLEDGEMENTS:
474
475 Special thanks again to Rob Hubbard for making his rational number module
476 available and for helping to integrate it into the standard library. Thanks
477 are also due to John Cowan for his thorough testing and suggestions to improve
478 the new number implementation.
479
480
481 ------------------------------------------------------------------------------
482
483 * 7.1 11 June 2006
484
485 This release sports some critical bugfixes and optimizations in the
486 interpreter as well as some important new features. Most changes are there to
487 improve the handling of special forms. In particular, Q now has built-in
488 support for memoization of special arguments, call-by-pattern evaluation of
489 arguments during pattern matching, built-in lambda, and syntactic sugar for
490 if-then-else, lambdas, stream objects and enumerations, as well as lists and
491 stream comprehensions. All the remaining little warts of Q which I am aware of
492 have been cured as well. Despite all the new stuff under the hood, most
493 changes are rather unobtrusive so most existing scripts should work with
494 little or no changes. (But see below for a list of known backward
495 compatibility issues.)
496
497 As usual, please check the ChangeLog file and the language manual for all the
498 gory details. An overview of the most important user-visible changes follows.
499
500 COMPILER:
501
502 - Improved warning messages: Undeclared variable symbols are _not_ reported
503 with -w anymore (these messages are often a nuisance if you use lambda a
504 lot), and function symbols will only be reported as undeclared at the end of
505 a source file, if they are neither imported nor declared _anywhere_ in the
506 file (where appearances of a function symbol on the left-hand side of
507 equations and variable definitions count as implicit declarations). If you
508 want to play it *really* safe, there is a new warning level -w2 a.k.a.
509 --pedantic which warns about *all* function and variable symbols which are
510 used without a prior *explicit* declaration (i.e., when using that option
511 you really have to declare each and every symbol explicitly, to make the
512 compiler happy).
513
514 LANGUAGE:
515
516 - Syntactic sugar for streams and comprehensions: Streams can now be written
517 in the same kind of notation as lists, but using curly braces instead of
518 brackets, as in `{1,2,3}' or `{X|Xs}'. The new notation is translated to an
519 appropriate application involving the stream constructors `cons_stream' and
520 `nil_stream' (which are now predefined as builtins) by the parser, and is
521 also used when an expression is printed. Moreover, the parser recognizes the
522 notations `{1..10}' and `{1..}' for finite and infinite stream enumerations,
523 and the notation `[X..]' is now also supported for finite enumeration types.
524 There's also new syntactic sugar for list and stream comprehensions. E.g.,
525 you can now write `[2*X^2 : X in Xs, X mod 2 = 0]' as a shorthand for
526 `listof (2*X^2) (X in Xs, X mod 2 = 0)'. Stream comprehensions (streamof)
527 work the same, using curly braces instead of the brackets.
528
529 - New "grouping" syntax. Semicolons inside lists, streams and tuples can be
530 used to further partition the sequence into nested tuples. E.g., [A,B;C,D]
531 is the same as [(A,B),(C,D)]. This makes it easier to write stuff like lists
532 of key-value pairs, or the clauses of a conditional expression.
533
534 - Syntactic sugar for lambdas. Lambdas can now be written in the customary
535 form \X.Y, where X is the lambda pattern and Y the lambda body, and the
536 notation \X1 ... Xn.Y is provided as a shorthand for nested lambdas.
537
538 - Syntactic sugar for if-then-else. Instead of `ifelse X Y Z' you can now also
539 write `if X then Y else Z'. Likewise, `when X Y' can also be written as
540 `if X then Y'.
541
542 - Memoization of special arguments: There is a new memoization operator `&'
543 belonging to the group of quotation operators. When applied to a special
544 argument, this operator ensures that the argument will only be evaluated
545 once, at the time it is first accessed in a non-special context.
546
547 - Call-by-pattern: As suggested by Yann Orlarey, special subterms of
548 non-special args of function applications will now be evaluated
549 automatically as needed during the pattern matching process. Note that only
550 non-special arguments are treated in this manner. Special arguments still
551 remain unevaluated during pattern matching, so that special forms can be
552 used in a macro-like fashion as before.
553
554 - Other language extensions: There's an alternative syntax `type X == Y' to
555 declare type aliases, and var declarations can now include an initializer
556 (`var X = foo'); the latter was suggested by Rob Hubbard. Moreover, the
557 `var' keyword can now be used in front of a variable symbol on the right-
558 hand side of an equation or variable definition to escape free variable
559 symbols and declare them on the fly.
560
561 BUILTIN AND STANDARD LIBRARY FUNCTIONS:
562
563 - The `lambda' function is now provided as a builtin which "compiles" lambdas
564 to a special internal representation. (The old implementation is still
565 available, but has been moved to the examples folder.) As a result, `lambda'
566 itself and the stuff which depends on it are now generally much faster.
567 Non-linear patterns and patterns involving the anonymous variable are now
568 also handled correctly. Note that, despite the new look and feel, lambda is
569 still just an ordinary function, so Q's capabilities to manipulate lambdas
570 on the symbolic level are unimpaired, and list and stream comprehensions are
571 still implemented in the library (but are also much faster now, due to some
572 general performance gains in the implementation of special forms and the
573 speedups of the lambda function).
574
575 - The `switch' and `match' conditionals in the standard library have been
576 replaced with new special forms `cond' and `case'. The new conditionals are
577 more Lisp-like, and they also take advantage of the new grouping feature.
578 Example: sign X = cond (X>0, 1; X<0, -1; true, 0);
579
580 - The `+' and `-' operators can now be used to perform simple arithmetics on
581 enumeration types. If X is an enumeration type member then X+N and X-N
582 yield the Nth successor and predecessor of X, respectively, and if X and Y
583 are members of the same enumeration type then X-Y yields the integer N
584 s.t. X=Y+N. Moreover, typec.q offers a new typechecking predicate for
585 enumeration type members (isenum).
586
587 - The builtin trunc, round, float, int and frac functions now work
588 consistently on both integers and floating point values, and floor and ceil
589 functions have been added to math.q, as suggested by Rob Hubbard.
590
591 - The stream.q module provides a few new functions (repeat, repeatn, cycle;
592 strict, lazy and friends), and `cat' and `tuple' now work with streams, too.
593 Additional work has been done to improve the efficiency of some of the other
594 stream operations and prevent unnecessary reevaluations of stream members.
595
596 - The clib.q module now offers so-called "sentinels" as an additional type of
597 lazy expression references. Sentinels are evaluated when the sentinel object
598 is garbage-collected. This provides a means to implement ordinary Q data
599 structures which perform automatic cleanup in the same fashion as some
600 built-in and external data types.
601
602 - The getopt.q module has been added to the standard library, which provides a
603 quick-and-dirty replacement for the GNU getopt_long function.
604
605 BACKWARD COMPATIBILITY ISSUES:
606
607 For the sake of getting rid of most of (all?) the remaining warts in the
608 language and the library, there have been a few minor changes which break
609 backward compatibility in some places. They are listed below:
610
611 - The deprecated library functions `apply' and `compose' have been removed. If
612 you still have old code using these, you will have to replace them with the
613 builtins ($) and (.).
614
615 - The `switch' and `match' conditionals have been superseded by `cond' and
616 `case', so you will have to rewrite code using those. Translating the old
617 constructs to the new ones should be a piece of cake, though.
618
619 - Some of the thread operations in clib.q have been renamed. In particular,
620 `cond' has been renamed to `condition' (to resolve a name clash with the new
621 `cond' conditional), and `sem' has been renamed to `semaphore'. The
622 corresponding types are now named `Condition' and `Semaphore', respectively.
623
624 - List and stream comprehensions are now defined in cond.q. (Actually this
625 shouldn't be an issue unless you explicitly use qualified identifiers for
626 the listof and streamof operations.)
627
628 ACKNOWLEDGEMENTS:
629
630 This release also contains a new version of Tim Haynes' cgi.q script, and the
631 initial release of Rob Hubbard's rational.q module. Both can be found in the
632 examples directory. Thanks, Rob and Tim, for your contributions, and thanks
633 also to John Cowan for proofreading the manual, and the members of the Q
634 mailing list for helping to sort out various design and implementation issues.
635
636
637 ------------------------------------------------------------------------------
638
639 * 7.0 18 February 2006
640
641 The latest and greatest Q release comes with quite a few notable changes and
642 improvements which is why we made this a major release. For the most part,
643 this release should be backward-compatible with Q 6.2, so existing scripts
644 should still work with minimal or no changes. Below you can find a brief
645 summary of the major user-visible changes. As usual, additional information
646 can be found in the ChangeLog and the manual.
647
648 1. Unicode support. Character strings are now internally represented using the
649 UTF-8 encoding, and the interpreter handles the necessary translations between
650 the internal representation and the system encoding automatically and
651 transparently. Existing 7 bit ASCII applications should continue to work
652 without any changes, but if unicode support is enabled (which is the default
653 if your system has the necessary bits and pieces) then string literals can now
654 also contain extended characters from the entire Unicode character set which
655 will be treated as single Char objects. In addition, Unicode characters can
656 now also be used in identifiers and operator symbols.
657
658 NB: Please note that the unicode features have not yet been tested extensively
659 in non-Western locales, and thus should be considered "beta". Bug reports and
660 other inputs, especially from Q programmers using Eastern locales, will be
661 greatly appreciated. :)
662
663 2. Internationalization and localization support. The clib module now provides
664 the necessary operations to program applications which deal with different
665 language environments, such as setlocale, strfmon, strcoll, as well as
666 interfaces to GNU iconv and gettext.
667
668 3. C/C++ API: The version numbers of the libq and libqint libraries have been
669 incremented to account for binary incompatibilities with Q 6.0 and
670 earlier. Thus you will have to make sure that you recompile modules for the
671 latest release. (Actually, this change has been overdue since Q 6.1, so we
672 took the opportunity to make up for that with this major release.)
673
674 4. Gnocl/Q GUI builder. As a bonus, the Tcl/Tk interface now includes special
675 support for Peter G. Baum's Gnocl (http://gnocl.sf.net), a Tcl extension for
676 creating GNOME/GTK+ applications with Tcl. A full-featured GUI builder based
677 on the new Q-Gnocl interface, which generates native Q code, is also
678 available. Please see modules/tk/gqbuilder/README for details.
679
680 5. Packaging. Managing binary releases for an ever-growing collection of
681 separate add-on modules has slowly turned every major release of the core
682 package into a big nightmare. So, starting with this release, while the core
683 package and the add-on modules are still distributed as separate source
684 tarballs, there will be only one binary package for the entire Q programming
685 system. Thus, on systems for which we provide binaries, you can now just
686 install the "one big package" and be done with it.
687
688 ACKNOWLEDGEMENTS: Thanks are due to John Cowan for his help and suggestions
689 concerning all things unicode and other issues, as well as his tireless
690 testing and bug reporting to make the Cygwin port work.
691
692
693 ------------------------------------------------------------------------------
694
695 * 6.2 13 July 2005
696
697 This release finishes off the revision of the tuple syntax which was started
698 with Q 6.1 (see below for details). The deprecated 1-tuple syntax (X) has been
699 removed, so that the construct (X) now always denotes a parenthesized
700 expression.
701
702 Moreover, this release also adds support for user-defined operators. E.g., you
703 can now define yourself an exclusive-or operator with the same precedence as
704 the built-in `or' as follows:
705
706 public (xor) X Y @ 3;
707 X xor Y = (X or Y) and not (X and Y);
708
709 Please see the ChangeLog and the manual for details.
710
711
712 ------------------------------------------------------------------------------
713
714 * 6.1 10 July 2005
715
716 This release sports a few bug fixes (see the ChangeLog for details), new when
717 and unless conditionals in the standard library, a new sign-on message in the
718 interpreter and, most importantly, the following changes in the Q language:
719
720 - Per request by Tim Haynes, there's a new right-associative infix application
721 operator ($) which has the same meaning as in Haskell. See the language
722 manual for details.
723
724 - Following a suggestion by John Cowan, we're currently in the process of
725 straightening out Q's 1-tuple syntax which is a bit confusing for most Q
726 programmers, as it interferes with the syntax of parenthesized expressions.
727
728 In this release, the 1-tuple notation (X), where X is a primary expression,
729 is still accepted but deprecated, and it produces a warning message. The new
730 recommended 1-tuple syntax is (X,), as in Python. (Actually, all lists and
731 tuples can now have a trailing comma behind the last element, see the
732 language manual for details.)
733
734 Note that beginning with the next release, the new syntax will be
735 _mandatory_, and the notation (X) will _always_ denote a parenthesized
736 expression, so you should now start fixing your scripts accordingly.
737
738 - The deprecated Prolog-style % syntax for comments is no longer valid.
739
740
741 ------------------------------------------------------------------------------
742
743 * 6.0 23 October 2004
744
745 This release adds SWIG support to the Q programming system. This is an
746 important milestone in the development of the Q programming system, as it
747 makes interfacing to existing C and C++ libraries much easier.
748
749 SWIG is the "Simplified Wrapper and Interface Generator" which allows you to
750 create C/C++ wrapper modules for various target languages in an easy way. More
751 information about SWIG is available at http://www.swig.org. Preliminary
752 documentation for Q's SWIG support and some examples can be found in the
753 modules/swig directory in the sources.
754
755 Note that until the SWIG-Q module becomes part of the official SWIG
756 distribution, to use SWIG with Q you'll need a SWIG version which has been
757 patched up to add support for the Q language. For the time being, a suitable
758 SWIG package can be found on the Q homepage.
759
760 IMPORTANT: To implement the SWIG support, the libq ABI had to be changed, so
761 you will have to recompile your modules (and reinstall the latest RPMs of
762 add-on modules from the Q homepage) to make existing modules work with the new
763 Q version.
764
765
766 ------------------------------------------------------------------------------
767
768 * 5.5 2 October 2004
769
770 This is a bug fix release. Moreover, the Windows package now includes the
771 latest GGI from CVS.
772
773
774 ------------------------------------------------------------------------------
775
776 * 5.4 14 September 2004
777
778 This release adds a libxml2/libxslt interface, a new profiling command in the
779 interpreter (try `help profile' for more information), and a few bug fixes and
780 updates for third-party software (see the ChangeLog for details).
781
782
783 ------------------------------------------------------------------------------
784
785 * 5.3 15 April 2004
786
787 Another bug fix release (see the ChangeLog for details). As a bonus, you also
788 get a new built-in function composition operator (.) which works like
789 stdlib::compose, but can be used as an infix operator and also adapts itself
790 to special forms in its operands. (Note that stdlib::compose is now deprecated
791 and will be removed from the library in the future.) A closer description of
792 the (.) operator can be found in the manual (try `help composition' in the
793 interpreter).
794
795
796 ------------------------------------------------------------------------------
797
798 * 5.2 29 February 2004
799
800 This is a minor update with some bug fixes, optimizations, and two new looping
801 constructs (dowhile, for) in the standard library.
802
803
804 ------------------------------------------------------------------------------
805
806 * 5.1 20 February 2004
807
808 This release brings an overhaul of the virtual Q machine, which is now fully
809 tail-recursive, a new `enum' builtin along with the usual syntactic sugar for
810 enumerations, a new `qcwrap' utility for creating C wrappers from Q scripts,
811 and a couple of bug fixes and improvements in the build system.
812
813 - Tail call elimination: The interpreter now also performs tail call
814 optimization for builtins and special arguments, so that tail-recursive
815 definitions involving special forms like (and then), (or else) and `ifelse'
816 are executed in constant stack space.
817
818 - Enumerations: Compiler and interpreter now understand the `[X..Y]' syntax
819 for specifying ranges of integers, floating point numbers and enumeration
820 type members. See Section 8.2 of the Q language manual for details.
821
822 - C wrappers: With the new `qcwrap' utility, which is bootstrapped from the
823 src/qcwrap.q script, you can now turn a Q script into a C program which can
824 be compiled to create a self-contained binary executable. See Appendix B.5
825 of the manual for details.
826
827 - Build system: Most notably, running configure and make in a separate
828 directory now works, provided you have a VPATH-capable make utility like GNU
829 make. Moreover, `make test' can now be run before the interpreter is
830 installed.
831
832 - Bug fixes: Most notably, lambda now finally checks that the pattern is
833 linear -- computers should be fast enough now to afford that. ;-)
834
835
836 ------------------------------------------------------------------------------
837
838 * 5.0 31 January 2004
839
840 This release sports some changes in the C interface and the standard library
841 warranting a new major release number. It also includes important new features
842 and bug fixes in the debugger and additional facilities for web programming.
843 We expect this to become the stable release of the core system for quite some
844 time now (bug fixes notwithstanding). The user-visible changes are listed
845 below. As usual, all the gory details can be found in the ChangeLog.
846
847 - Libq has been overhauled. Some old stuff has been removed and a few useful
848 additional expression operations have been added. IMPORTANT: Since the
849 binary interface has changed you'll have to recompile your external
850 modules. Also make sure that you reinstall the latest versions of other
851 add-on modules like Q-Audio, which are distributed as separate packages.
852
853 - Brand new C->Q interface: The libqint library now allows you to embed the Q
854 interpreter in your C/C++ applications in a direct fashion. See the last
855 section of Appendix C in the manual for further details.
856
857 - Web programming: There's a new Q module for the Apache web server, see
858 mod_q/README for more information. Moreover, the new `curl' module provides
859 an interface to libcurl which allows you to transfer files with URL syntax
860 using a variety of different Internet protocols; see README-Curl for details.
861
862 - Standard library: Some final cleanup and polishing. Specifically, new
863 curry/uncurry functions have been added (see stdlib.q), the unzip
864 operation has been overhauled, and scan/scan1 have been replaced with a
865 semantically complete set of scan functions (scanl/scanl1/scanr/scanr1),
866 which is also compatible with Haskell. The stuff which used to be in comp.q
867 has been moved to prelude.q, along with the overloaded succ and pred
868 operations from stdlib.q.
869
870 - Debugger improvements: The command syntax has undergone another face-lift,
871 and there are new commands to set breakpoints on function symbols. Readline
872 support was added as well, and some bugs were fixed (in particular, the `n'
873 command now works correctly with recursive evals). See Appendix D in the
874 manual for more information.
875
876 - Compiler warnings (as suggested by Mathias Bruessel): There is a new
877 compiler option (-w a.k.a. --warnings) to enable warnings about undeclared
878 function and variable symbols. If this option is in effect, then the
879 compiler complains about each undeclared symbol on the right-hand side of a
880 definition or equation, so you will have to declare or define all symbols
881 before they are used, to make the compiler happy. This may be annyoing at
882 times, but helps a lot to avoid silly typos in larger scripts, which might
883 otherwise go unnoticed and produce hard-to-find bugs at runtime.
884
885
886 ------------------------------------------------------------------------------
887
888 * 4.6 6 January 2004
889
890 This release features a much improved GGI interface and a new magick module
891 which uses ImageMagick to load, save and manipulate images in a variety of
892 file formats. Of course, you can also transfer the pixel data from ImageMagick
893 images to GGI visuals and vice versa.
894
895 BIG NEWS: Q is now on SourceForge! As of December 2003, Q has become a
896 SourceForge-hosted project, which can be found at the following URL:
897
898 http://sourceforge.net/projects/q-lang/
899
900 There you can now obtain released source and binary packages (check the
901 "Files" link on the project page), as well as the latest and greatest
902 development sources in CVS ("CVS" link). Two mailing lists for discussing Q
903 development and usage are also available ("Lists" link).
904
905
906 ------------------------------------------------------------------------------
907
908 * 4.5 14 October 2003
909
910 This release sports a new ggi module (general graphics interface, see
911 http://www.ggi-project.org), and some improvements in the debugger (see the
912 ChangeLog for details).
913
914
915 ------------------------------------------------------------------------------
916
917 * 4.4 16 September 2003
918
919 The new ODBC module allows you to connect to ODBC-compatible databases (MySQL,
920 PostgreSQL, ...). There are also a few minor changes and bug fixes, see the
921 ChangeLog for details.
922
923
924 ------------------------------------------------------------------------------
925
926 * 4.3.2 15 August 2003
927
928 Additional changes for BSD compatibility, bug fixes.
929
930
931 ------------------------------------------------------------------------------
932
933 * 4.3.1 28 July 2003
934
935 Fixes for latest autotools and FreeBSD compatibility, bug fixes.
936
937
938 ------------------------------------------------------------------------------
939
940 * 4.3 13 June 2003
941
942 Free variables can now be declared `const', meaning that they are read-only,
943 i.e., they can only be assigned a value once. A couple of bugs were fixed,
944 too, see the ChangeLog for details.
945
946
947 ------------------------------------------------------------------------------
948
949 * 4.2.3 6 May 2003
950
951 Added some missing stuff to clib, and a new gdbm module which provides an
952 interface to the GNU dbm library.
953
954
955 ------------------------------------------------------------------------------
956
957 * 4.2.2 3 May 2003
958
959 Some additional improvements in the standard library. In particular, the new
960 Ref type in the clib module now allows you to create mutable data structures
961 in a direct manner.
962
963
964 ------------------------------------------------------------------------------
965
966 * 4.2.1 25 April 2003
967
968 Improvements in the clib module (automatic int/float coercion in the printf
969 operations, new openpty and forkpty operations) and some minor fixes in the
970 documentation.
971
972
973 ------------------------------------------------------------------------------
974
975 * 4.2 26 March 2003
976
977 Good news for Macintosh aficionados: Q has finally been ported to OS X!
978 Moreover, the interpreter now provides signal handling via the new `trap'
979 builtin, and the clib module has had a major overhaul and now provides well
980 over 200 functions. Most essential UNIX system operations have been
981 implemented, including the POSIX termios and BSD socket interfaces.
982
983 Furthermore, some bugs have been fixed, and some quirks with realtime thread
984 scheduling under Linux and Windows have been resolved. NOTE: Take a look at
985 modules/clib/givertcap if you want to enable realtime scheduling in a non-root
986 application under Linux.
987
988
989 ------------------------------------------------------------------------------
990
991 * 4.1.3 18 February 2003
992
993 Minor code cleanup and bug fixes; see ChangeLog for details.
994
995
996 ------------------------------------------------------------------------------
997
998 * 4.1.2 24 November 2002
999
1000 Some minor bug fixes in the interpreter and the clib and dxl modules.
1001
1002
1003 ------------------------------------------------------------------------------
1004
1005 * 4.1.1 19 November 2002
1006
1007 Bugfix in the builtin catch function.
1008
1009
1010 ------------------------------------------------------------------------------
1011
1012 * 4.1 11 November 2002
1013
1014 This is a minor update with some cleanup in the standard library, various
1015 improvements in the debugger and q-mode.el, updated documentation, and fixes
1016 for Tcl/Tk 8.4 compatibility. Moreover, a new builtin function `which' has
1017 been added which facilitates package configuration. Please refer to the
1018 ChangeLog for details.
1019
1020
1021 ------------------------------------------------------------------------------
1022
1023 * 4.0 3 November 2002
1024
1025 Ok, enough features have been added since release 3.1 now, so I decided it's
1026 time for a major release again. This release includes all the cumulative
1027 changes of the 3.x series, some more bug fixes (see the ChangeLog for
1028 details), and the following additional changes:
1029
1030 - Equations may now include an arbitrary list of conditions and where clauses,
1031 in any order. See below for details.
1032
1033 - The `=' operator must now be parenthesized on *both* the left- and right-
1034 hand sides of equations and definitions.
1035
1036 This means that some definitions in existing scripts might have to be
1037 changed, but this is a small price for enabling the compiler to find obscure
1038 errors where a definition is mistaken for an equality check (which can
1039 happen much too easily, e.g., when forgetting the semicolon at the end of an
1040 equation, or the comma at the end of a definition).
1041
1042 - The tk module now includes additional operations for setting and retrieving
1043 variable values in the Tcl/Tk interpreter.
1044
1045 - The sample exception scripts (except.q, clib_except.q, etc.) have been moved
1046 back to the examples directory, which is where they really belong.
1047
1048 The most notable change in this release is that an equation may now include an
1049 arbitrary list of conditions and where clauses, in any order. Thus the
1050 arbitrary restriction to "where-if-where" constructs has been removed. As
1051 before, the conditions and where clauses are processed from right to left,
1052 whereas the individual definitions in a where clause are considered from left
1053 to right. As soon as a condition or variable definition fails, the entire rule
1054 is aborted. This allows you to have definitions like, for example,
1055
1056 foo X = bar Y if qux Y where Y = baz Z if quux Z where Z = ...;
1057
1058 which interleaves conditions with the definitions of required variables, or
1059
1060 foo X = bar Y where Y = baz Z where Z = qux U where U = ...;
1061
1062 which incrementally builds a value through a series of definitions. (Note that
1063 the latter is actually equivalent to `foo X = bar Y where U = ..., Z = qux U,
1064 Y = baz Z;' but for many examples the "backward" order is just more natural.)
1065
1066 The debugger was modified as well, to acommodate for the above change. It now
1067 stops on the current rule every time a condition or definition has been
1068 processed, and always displays the current qualifier while it is being
1069 processed. This makes it much easier to keep track of a rule with many
1070 different conditions and local definitions.
1071
1072
1073 ------------------------------------------------------------------------------
1074
1075 * 3.5.5 28 October 2002
1076
1077 This release fixes segfaults in the builtin hash function and the tk module.
1078
1079
1080 ------------------------------------------------------------------------------
1081
1082 * 3.5.4 10 October 2002
1083
1084 This release fixes a compiler bug which caused wrong bytecode to be generated
1085 when parsing multiple right-hand sides involving where clauses for the same
1086 left-hand side. It also works around a bug in the MSVC sscanf function which
1087 affected the clib sscanf function (Windows only).
1088
1089
1090 ------------------------------------------------------------------------------
1091
1092 * 3.5.3 8 October 2002
1093
1094 This release fixes some obscure segfaults in the debugger and the builtin
1095 tuple concatenation function.
1096
1097
1098 ------------------------------------------------------------------------------
1099
1100 * 3.5.2 6 October 2002
1101
1102 This is a maintenance release which fixes some compilation quirks on the
1103 latest Linux distros which come with Tcl/Tk 8.4 and gcc 3.2.
1104
1105 Other changes:
1106
1107 - The variable file is now named .q_vars by default, so it is hidden on Unix
1108 systems.
1109
1110 - I also started working on the floating point precision of the `save'
1111 command. The precision used by `save' is now larger to reduce rounding
1112 errors when reconstructing these values with `load'. Moreover, I added
1113 experimental support for saving exact floating point values represented in
1114 hexadecimal textual format. Currently this only works on systems with a
1115 C99-compatible printf function which has the %a conversion flag. (Add
1116 -DHAVE_ISO99_PRINTF to the list of compilation flags when compiling to
1117 enable this feature.)
1118
1119
1120 ------------------------------------------------------------------------------
1121
1122 * 3.5.1 19 September 2002
1123
1124 New in this release:
1125
1126 - Bug fixes in the standard library (cond.q, list.q, stream.q) and in the
1127 interpreter's garbage collector (--gc option).
1128
1129 - Larger default stack size.
1130
1131 - Clib: New `gets' and `fgets' operations to read a line with the trailing
1132 newline. The former `gets' function (which reads a whole file at once) has
1133 been renamed to `fget'.
1134
1135
1136 ------------------------------------------------------------------------------
1137
1138 * 3.5 September 2002
1139
1140 This release features some more bug fixes and cosmetic changes in the
1141 interpreter and Emacs Q mode; see the ChangeLog for details. The most
1142 important user-visible changes are the following:
1143
1144 - Local definitions (`where') are now permitted both before and after a
1145 qualifying condition. A `where' clause before the condition will only be
1146 processed after the condition has been checked.
1147
1148 - The standard library now also includes a hashed dictionary type which can be
1149 used for arbitrary (not necessarily ordered) key values. See hdict.q.
1150
1151
1152 ------------------------------------------------------------------------------
1153
1154 * 3.4.3 August 2002
1155
1156 More bug fixes: The builtin syntactic equality predicate is now implemented
1157 non-recursively, to prevent C stack overflows on large expressions. Special
1158 interpreter commands like `echo' and `cd' now accept string arguments enclosed
1159 in single quotes.
1160
1161
1162 ------------------------------------------------------------------------------
1163
1164 * 3.4.2 July 2002
1165
1166 This release fixes .qinitrc/.qexitrc execution, and parse stack overflows
1167 which occurred when sourcing long lists and tuples in the interpreter.
1168 Moreover, the import command now also works correctly if the main module is
1169 the empty script.
1170
1171
1172 ------------------------------------------------------------------------------
1173
1174 * 3.4.1 18 June 2002
1175
1176 Bug fixes in the tk module. The interpreter doesn't lock up on tk and tk_reads
1177 any more, and the Tcl/Tk interpreter is now thread-local.
1178
1179 (NB: Starting with this release, I'm using 3-level version numbers when
1180 appropriate to make it easier to handle frequent bugfix-only releases.)
1181
1182
1183 ------------------------------------------------------------------------------
1184
1185 * 3.4 14 June 2002
1186
1187 Again a bug fix release. Adds some functions to the C interface which help to
1188 alleviate some weird segfaults in the Windows version.
1189
1190
1191 ------------------------------------------------------------------------------
1192
1193 * 3.3 June 2002
1194
1195 Bug fix release. Fixes an annoying bug in the compiler which caused wrong
1196 bytecode to be generated if a variable definition followed an equation with a
1197 where clause.
1198
1199
1200 ------------------------------------------------------------------------------
1201
1202 * 3.2 May 2002
1203
1204 Maintenance release. Most notably, the size of the expression data structure
1205 has been reduced considerably (24 bytes per expression cell vs. 36-40 bytes in
1206 earlier releases) without any performance losses. Also adds support for
1207 bounded semaphores (see clib.q).
1208
1209
1210 ------------------------------------------------------------------------------
1211
1212 * 3.1 April 2002
1213
1214 This is a major new release featuring a lot of smaller bug fixes and
1215 optimizations, as well as some important new features, most notably: improved
1216 modularization facilities, pattern-matching and rule-local variable
1217 definitions, and multithreading support. See the more detailed list of
1218 user-visible changes below.
1219
1220 (Note that 3.0 was never officially released, hence what follows is the list
1221 of cumulative changes since release 2.3.)
1222
1223 - MODULES: This release cures one of the most apparent shortcomings in earlier
1224 Q versions: the lack of decent support for "programming in the large". The
1225 new module system is both simple and effective. Different scripts are now
1226 considered as separate modules, each with their own namespace, and you must
1227 *always* explicitly include a module to gain access to the public symbols of
1228 that module (with the exception of the prelude operations which are still
1229 available without explicit inclusion). The new syntax for including modules
1230 is:
1231
1232 import id1, id2, ...;
1233 include id1, id2, ...;
1234
1235 Modules may either be specified using their name (which must be a valid
1236 identifier) or the full pathname in double quotes (the .q suffix is supplied
1237 automatically if necessary). The import and include directives differ in
1238 that the latter causes all public symbols of the included module to be
1239 reexported, whereas the former only makes the symbols available in the
1240 importing module.
1241
1242 To resolve name clashes between modules, you can import a module under an
1243 alias, e.g.:
1244
1245 import "my/prelude" as myprelude;
1246
1247 To resolve name clashes between public symbols in different modules, you can
1248 use qualified identifiers of the form modname::id. You can also redeclare an
1249 imported symbol under a new name:
1250
1251 private mylib::foo X Y as bar;
1252
1253 If you redeclare an imported symbol as a public symbol, it will be
1254 reexported.
1255
1256 IMPORTANT: The first declaration of an unqualified symbol in a given module
1257 will now always introduce a *new* symbol; this has to be considered when
1258 porting pre-3.0 scripts. Moreover, new symbols in a module are now declared
1259 "private" by default, so you have to explicitly declare symbols with scope
1260 "public" if they are to be used outside a module.
1261
1262 The namespace available in the interpreter is now that of the main module,
1263 and the interpreter also allows you to dynamically import (and unimport)
1264 additional modules in the global scope. As before, it is possible to gain
1265 access to *all* public and private symbols of the program (also in modules
1266 not directly imported in the main module) using qualified identifiers.
1267
1268 The downside of all this good new stuff is that it really breaks backward
1269 compatibility in some places. But most scripts should work after a minor
1270 touch-up, adding some public keywords and module qualifiers here and there.
1271 Also note that cyclic inclusion chains are not allowed any more, as they
1272 cannot be handled in a single-pass compilation.
1273
1274 - PATTERN BINDINGS: Variable definitions can now involve a pattern on the
1275 left-hand-side which is to be matched against the supplied value. E.g.,
1276
1277 def (X,Y) = foo Z;
1278
1279 evaluates foo Z, matches it against (X,Y) and binds the free variables X and
1280 Y accordingly. Non-linear patterns like (X,X) also work as expected. An
1281 error is reported if the match fails.
1282
1283 - ANONYMOUS VARIABLE: Q now supports the use of _ as an anonymous variable:
1284
1285 hd [X|_] = X;
1286 tl [_|Xs] = Xs;
1287
1288 This is handy if you don't care about a component value on the left-hand
1289 side. The anonymous variable can only be used on the left-hand side of a
1290 rule or definition. Multiple instances of the anonymous variable are matched
1291 independently from each other, therefore
1292
1293 foo _ _ = 0;
1294
1295 will be matched for *any* combination of arguments.
1296
1297 The interpreter now also employs the anonymous variable symbol for denoting
1298 the result of the last expression, instead of the $ symbol used in previous
1299 releases.
1300
1301 Note that, for backward compatibility, the underscore normally still counts
1302 as a lowercase letter, and thus any other identifier starting with _ is
1303 considered as a *function* symbol; the anonymous variable is the only
1304 exception from this rule.
1305
1306 - LOCAL VARIABLE DEFINITIONS: Local variables in a rule can now be introduced
1307 by means of "where" clauses:
1308
1309 foo X = bar Y Z where Y = f X, Z = g Y;
1310
1311 Where clauses always come behind the right-hand side *and* qualifier of a
1312 rule, and the defined variables are available in *both* the right-hand side
1313 and the qualifier:
1314
1315 foo X = bar Y Z if check Z where Y = f X, Z = g Y;
1316
1317 Pattern-matching definitions are permitted as well. Here, a failing match
1318 causes the entire rule to fail. For instance,
1319
1320 foo Z = bar X Z where [X|_] = Z;
1321
1322 works like
1323
1324 foo [X|Xs] = bar X [X|Xs];
1325
1326 but avoids repeating the list value on the right.
1327
1328 Variable bindings in where clauses are performed in the given order, and
1329 each definition may refer to all left-hand side variables of the rule, as
1330 well as all variables introduced in earlier definitions. Each use of a
1331 variable refers to its most recent definition. Note that, in difference to
1332 languages like Haskell, "where" clauses cannot be nested, and they can only
1333 be used to introduce local *variable* definitions, i.e., "local equations"
1334 are not supported.
1335
1336 - EXCEPTION HANDLING: The builtin functionality has not changed, except that
1337 now hard error conditions generate an exception of the form syserr N, where
1338 N is the error number. The syserr symbol is actually a constructor symbol of
1339 the new builtin type SysException, which in turn is a subtype of the
1340 predefined (abstract) type Exception. It is recommended that you use this
1341 scheme for your exception generating rules as well, deriving suitable
1342 subtypes of the Exception type for your exceptions. This discipline helps to
1343 make exception handling much more transparent, and allows you to
1344 discriminate over different exception types without having to resort to
1345 matching individual exception patterns.
1346
1347 The new except.q standard library module implements exceptions along this
1348 line for all builtin and standard library operations; the additional
1349 graphics_except module provides exceptions for the optional graphics
1350 module. Note that these modules are not loaded by default, thus you
1351 have to include them explicitly if you want exceptions to be generated.
1352
1353 - MULTITHREADING SUPPORT: This release provides POSIX-based multithreading.
1354 So, for instance, you can now perform a lengthy calculation as a background
1355 task simply as follows:
1356
1357 ==> def TASK = thread (sum (nums 1 1000000))
1358
1359 ==> // do some other work ...
1360
1361 ==> result TASK // get the result
1362 500000500000
1363
1364 ==> stats // stats lists secondary threads once they're finished
1365 0 secs, 1 reduction, 0 cells
1366 thread #1: 8.42 secs, 2000003 reductions, 2000007 cells
1367
1368 The multithreading operations are actually implemented in the clib module.
1369 All the good stuff from the POSIX threads library is there: thread
1370 creation, termination, cancellation, mutexes, conditions, semaphores, ...
1371 See the clib documentation for more details. Note that for all this to
1372 work, you must have the pthread library on your system, and the interpreter
1373 must have been built with thread support (which is the default when the
1374 library is available). Also note that the interpreter with thread support is
1375 a little slower and also needs more memory, compared to the no-thread
1376 version. Moreover, the current implementation effectively serializes
1377 bytecode interpretation on the reduction level and thus user-level
1378 threads cannot really take advantage of multi-processor machines.
1379
1380 - STANDARD LIBRARY: The standard library has gone through a major overhaul, to
1381 accommodate for the new language features. For the most part, the library
1382 should be backward-compatible, but note the following changes:
1383
1384 - clib is now "officially" part of the standard library and is thus loaded
1385 in the default prelude
1386 - examples for the external modules are now installed in corresponding
1387 subdirectories of the examples directory
1388 - for convenience, the `in' symbol used in list and stream comprehensions is
1389 now a predefined relational operator, hence parentheses around the pattern
1390 and list expression are not needed anymore
1391 - removed obsolete std module
1392 - removed obsolete `let' operation from lambda.q (use where clauses instead)
1393 - moved the stuff in the type module into stdlib
1394 - new multithreading primitives in the clib module (see above)
1395 - renamed the simple conditional `cond' in cond.q (which collides with the
1396 new condition constructor in clib.q) to `ifelse'
1397 - new except and graphics_except modules (see above)
1398 - new dxl_file function in the dxl module (see dxl_sample.q for an example)
1399
1400 - COMPILER: Bytecode files now have the executable bit set, and the bytecode
1401 format includes an additional #! header line which allows bytecode files to
1402 be executed directly as shell scripts. Note that this will only work with
1403 UNIX shells supporting the "#!" feature.
1404
1405
1406 ------------------------------------------------------------------------------
1407
1408 * 2.3 September 2001
1409
1410 This is a maintenance release featuring several bugfixes for Solaris
1411 compatibility (no functional changes). See the ChangeLog for details.
1412
1413
1414 ------------------------------------------------------------------------------
1415
1416 * 2.2 August 2001
1417
1418 Well, as you know, Q 2001 was supposed to be the last and final word, but I
1419 didn't get it quite right at the first attempt. :( This release is supposed
1420 to cure the remaining bugs and warts of release 2.1, and also introduces some
1421 new features which have been left out until now due to lack of time.
1422
1423 The most important user-visible changes are:
1424
1425 - Reorganized the sources and integrated all available modules into the main
1426 package. While I was at it, I also automakified and libtoolized the sources,
1427 which should improve portability. In particular, the C interface should now
1428 work on any platform supported by libtool, and it is now possible to
1429 "preload" modules into the interpreter, which is necessary when debugging a
1430 module and to make modules work on systems lacking shared library support.
1431 To facilitate this, I have added a new utility, `qld' a.k.a. the "Q module
1432 linker", to the package.
1433
1434 With all the changes in the module system, the libq library is incompatible
1435 with earlier releases, so you will have to recompile your own modules.
1436 Please note that there are some minor changes in the libq interface (see the
1437 ChangeLog for details), so you'll probably have to modify your module
1438 sources accordingly. Sorry for breaking backward compatibility once again,
1439 but these changes were absolutely necessary to make the new module system
1440 work.
1441
1442 - Compiler: The meaning of the -w compiler option has changed (it now turns
1443 those annoying warnings *on*, not off); also, the warnings about overlapping
1444 rules have been improved.
1445
1446 - Interpreter: Now includes readline 4.2. Various improvements are: useable
1447 --gc option, bug fixes in the run command, and improved rule printing in the
1448 debugger. See the ChangeLog and the manual for details.
1449
1450 - Library: The lambda.q script has been overhauled again, and graphics.q is no
1451 longer part of std.q, so you have to include this script explicitly.
1452
1453 The currently available modules have all been integrated into the main
1454 package and are now installed along with the standard library. As a bonus,
1455 there is a new interface module for IBM's OpenDX data visualization software
1456 (UNIX/X11-based systems only). Since OpenDX is freely available under an
1457 open source license, this should be interesting news for researchers
1458 developing scientific applications using a Q/Octave combo.
1459
1460 New features of compiler and interpreter:
1461
1462 - Improved tail recursion optimization: Toplevel sequences (||) in rule rhs's
1463 and qualifiers as well as variable definitions are now compiled to bytecode
1464 employing direct manipulation of the evaluation stack. This has the
1465 important consequence that basic imperative-style looping constructs like
1466
1467 loop X = foo X || loop X if bar X;
1468 = () otherwise;
1469
1470 are now executed in constant stack space, as one might reasonably expect.
1471
1472 - Exception handling: The new `catch' and `throw' builtins implement the
1473 usual catch/throw exception handling paradigm. This also allows you to
1474 handle runtime errors like memory or stack overflow. Furthermore, the `fail'
1475 function allows you to cause a rule to fail while it is already being
1476 executed.
1477
1478 - Rule priorities: You can now explicitly specify rule priorities with the @N
1479 directive.
1480
1481
1482 ------------------------------------------------------------------------------
1483
1484 * 2.1 Dec 2000 "Q 2001" ***10th Q ANNIVERSARY***
1485
1486 If you look further down in this file, you'll notice that it is Q's 10th
1487 anniversary (well, almost), so you can reasonably expect something
1488 special. ;-) So here goes ...
1489
1490 I decided that it was about time to release a polished version of the Q
1491 programming systems, which brings the language and the standard library out of
1492 its notorious beta status. With this "Q 2001" release, the core system,
1493 including the language definition itself, has been dubbed "stable." This means
1494 that future releases will now enforce backward compatibility, and concentrate
1495 on additional scripts and modules as well as improvements and new developments
1496 in the interpreter (such as multi-threading, which is planned for release 3.0,
1497 but don't hold your breath yet ;-).
1498
1499 Please note that the directory layout has changed in the present release, so
1500 make sure that you ***completely remove any existing Q installation*** before
1501 installing the new release.
1502
1503 Q 2001 features a bunch of small changes and additions, too many to list them
1504 here, so please check the documentation for details. The most important
1505 user-visible changes are pointed out below.
1506
1507 *** BUG FIXES ***
1508
1509 Some more (obscure) bugs were fixed:
1510
1511 - C interface (wrong reference counting; missing argument checks; the sym
1512 macro now creates new symbols if they do not exist).
1513
1514 - Rare segfaults in the lexical analyzers and the interpreter's main loop
1515 reader.
1516
1517 - Several compiler bugs, which allowed mismatching declarations of variable
1518 symbols, and equations with a non-symbol constant as the head of an
1519 application on the left-hand side of a rule. Moreover, free variable symbols
1520 on the left-hand side of an equation now produce an error message.
1521
1522 - Invoking the interpreter from Qpad now also works under Windows
1523 2000/NT. Furthermore, the builtin `run' command has been rewritten to avoid
1524 the overhead of an execvp() call, which has the nice side-effect that it works
1525 now in Qpad too.
1526
1527 *** LANGUAGE ***
1528
1529 A lot of smaller fixes here, some of which also affect the library, rendering
1530 some old stuff obsolete.
1531
1532 - The new Char type is the subtype of String which denotes the single-
1533 character strings.
1534
1535 - Builtin relational ops now also apply to "enumeration types" (types solely
1536 consisting of nullary constant symbols), and logical operators also work on
1537 integers (doing bitwise logical operations).
1538
1539 - New syntax for 1-tuples, operator sections, and quote/force/splice
1540 operators.
1541
1542 - Character escapes in strings can now also use the \0xhh and \0ooo syntax to
1543 denote character codes in hexadecimal and octal.
1544
1545 - New builtin functions (fclose, pred, succ, time, sleep) and some minor
1546 changes in existing builtins (ord, isconst, isfun). In particular, the
1547 `random' function now returns 32 bit random _integers_ instead of floating
1548 point values, and uses a new algorithm ("Mersenne Twister" by Makoto Matsumoto
1549 and Takuji Nishimura, see random.c).
1550
1551 *** INTERPRETER ***
1552
1553 You will find some new command line options, as well as new and improved
1554 commands and an overhauled command syntax (more "shell-like" for the "special"
1555 commands). In particular, I'd like to point you to the new `stats' command,
1556 which is quite useful for profiling purposes. Furthermore, the `break' command
1557 now allows you to control the interpreter's behaviour in response to
1558 exceptions (Ctl-C, break function, invalid qualifier). Again, please refer to
1559 the language manual (Appendix "Using Q") for details.
1560
1561 A lot of small improvements have been made in the interpreter code, which will
1562 mostly be invisible to the user. The installation procedure has been
1563 "modernized" to separate architecture-dependent and -independent files. You
1564 will now find the library scripts and some other useful items in
1565 <prefix>/share/q, whereas the architecture-dependent stuff like external
1566 modules goes to <prefix>/lib/q.
1567
1568 *** C INTERFACE ***
1569
1570 You'll also find some new features in the C interface (global module
1571 initialization and finalization, access to GMP mpz values). The new `qcc'
1572 utility should make it easier to translate external modules in a
1573 system-independent manner. I tested this with Linux and Windows, other systems
1574 may require some work. If you have any patches to make qcc (and the C
1575 interface/shared library support in general) work on your system please let me
1576 know. (Future versions should probably use libtool, in order to provide dlopen
1577 support for a greater variety of systems.)
1578
1579 *** LIBRARY ***
1580
1581 Some old stuff which is now provided as builtins has been removed, other parts
1582 have been polished, and a few new functions have been added. The special.q
1583 script is now named cond.q, and co