BEFORE 1.8
* properties of symbols
* Document fluid-let in manual.
* implement fn:reverse, fn:distinct-values
* rename sublist to subsequence.  deprecate sublist, item-at
* Should complain if user-defined function called with too many args.
* Compilation: not implemented mustConvert restarg
* XQuery distinguish qexo: kawa: fn: default function namespaces.
* Implement/document external functions, variables.
* Name mangling, document library modules.
* Finish namespace handling: namespaces in constructed nodes,
  fn:namespace-for-uri-prefix, get-in-scope-prefixes
* XML pretty-printing?
* Output formatting of empty arrays? (make-array (shape 0 0 0 3))

Remove pretty-print implementation in slib.

Optimize NumberCompare further.
document eval methods

BRL/KRL:
* sitedefs.scm should be loaded
* brl function should write to output, not be identity.
The default output-pourt shold be re-directed.
It should be the same as the ctx.consumer.

BEFORE KAWA 1.8?
* SRFI-9 (define-record-type) constructurs should not use reflection.
* Resolve whether #!/FILENAME can be followed by embedded options (meta-arg).
* Interpreter.getInterpreter should get current thread's.
* CL reader interface
* More define-class functionality?
* Finish modules: define-module?  constructor arguments?
* Handle defmacro definition and use in same source file.
* load.loadSource if (true) should be if (false).
* Implement Scheme API for serialization.
* Tail-calls in top-level functions should loop.
* Document in internals.html how ModuleMethod/ModuleBody works.

ORDER BY
for $x in q1 return r($x) = ValuesMap(r, q1)
  = eval q1 out: Consumer[writeObject(x) { eval r(x) out: mainConsumer}]

for $x in q1 order by o($x) return r($x) = OrderedMap(r, o, q1)

for $x in q1 for $y in q2($x) [where w($x,$y)] order by o($x,$y) return r($x) = OrderedMap(r, o, w, q1, q2)
consumer1 = Consumer[writeObject(x) {consumer2.x = x; eval q2 out: consumer2}]
consumer2 = Consumer[Object x;
                     storage for tuple sequence;
                     writeObject(y) {[if (w(x,y)] add(x,y) to tuple sequence}
                     sort() { sort the suple sequence }
                     out(Consumer out) { for each tuple eval r($x, $y) }]
eval q1 out: consumer1; consumer2.sort(); consumer2.out(mainConsumer);

for $x as int in e1 order by o1, o2 return r($x);

class tmp implements Consumer {
  Consumer out; // outer Consumer
  int[] x;  // Or Values x;
  Object[] y; // Or Values y;
  Object[] o1_save;
  Object[] o2_save;
  static void eval (CallContext ctx) {
    tmp t = new tmp;
    t.out = ctx.consumer;
    ctx.consumer = t;
    [compile e1](ctx);
    int n = x.length;
    sort(compare);
    ctx.consumer = t.out;
    for (int i = 0;  i < n;  i++)
      t.body(i, ctx);
  }
  sort() {
    o1_save = new Object[n];
    o2_save = new Object[n];
    mergesort;
  }
  int compare(int i, int j) {
    if (o1_save[i] == null)
      o1_save[i] = [o1[x[i]];
    if (o1_save[j] == null)
      o1_save[j] = [o1[x[j]];
    int c = compare(o1_save[i], o1_save[j]);
    if (c == 0) {
      if (o2_save[i] == null)
        o2_save[i] = [o2[x[i]];
      if (o2_save[j] == null)
        o2_save[j] = [o2[x[j]];
      c = compare(o2_save[i], o2_save[j]);
    }
    return c;
  }
  void writeObject (Object val) {
    x = x ++ [val];
  }
  void body(int i, CallContext ctx) {
    [compile r(x[i], ...)](ctx);
  }
}
for $x as int in e1, $y in e2 order by o1, o2 return r($x);

Optimize to avoid creating frame classes:
If a local variable is captured, and all functions intermediate between
the capture site and the definition are call-only functions, and the
local variable is never written (except before all calls to these
intermediate functions), then add the variable as an extra implicit
parameter to thse intermediate functions, instead of storing the
variable in a frame.

Optimize (call/cc (lambda (exit) ... (exit ...))) when exit is only
called, never read, to use BlockExp/ExitExp.  Assumes the latter are
extended to handle non-local exists - perhaps using the call/cc
machinery:  Advantage - in many cases call/cc is used to exit a
loop, so it can be inlined.

Perhaps CallFrame should extend ModuleBody.

Should inline when accessing a final static field (using static-field),
for int (or shorter) types - but only for "compile-time constants".
(Needs checking .class file that field is given ConstantValue.)

Starting (emacs) has wrong keybindings unless --elisp is specified.

Move kawa.lang.Lambda to gnu.kawa.lispexpr.Lambda.  Merge with Elisp version.
Remove Scheme.getTypeValue.

(define plus +) ... (plus ...) should not inline call to +.

(define-alias <alias> <class>) doesn't work interactively.

Implement IntRange class.
Use it to replace Char's hashtable.
Replace Char by Character.

Modules:
* Infer parameter and return types when defaulted and otherwise match
method in explicit module-extends or module-interface.

compile-file should generate .jar, not .zip.
Should perhaps take multiple file names.
Update manual to removing .zip references.

Binding for imported unknown names (idN$NAME) should not be static!

(this) needs to be more general/robust.
Start by forcing it to make the generated method non-static.
What about 'super' ?

Re-store code to check argument count when applyN is involved.
(in Compilation and maybe ApplyExp).

BindingInitializer.emit: global Environment should be cached

Add --inline and --no-inline flags.

TO BE DONE FOR 2.0:

Move more of kawa.lang.* to gnu.kawa.reflect and gnu.kawa.*.

Calls to setter (as in (set! (...)) should be inlined.

'object': being able to pass constructor arguments. eg., to simulate:
   new javax.swing.JDialog(myFrame) {  public void foo() {} };
Perhaps:  (object ((<javax.swing.JDialog> myFrame)) ...)

Fix scheme-window in misc.scm.

Generate better code for `(and test1 test2 test3)'.
[See maybe-report-section in testing.scm]

Module compilation:
* Allocated selector indexes "densely" within each applyX method
of a ModuleBody, so tableswitch gets used, rather than lookupswitch.

define-syntax and friends are not properly hygienic when checking
literals:  symbols listed among the literals lists are matched as
raw symbols, rather that checking that the symbol has the same
binding, if any, as at the defining site.

Complain if syntax or macro is used in other than function-call position.

Why is start pc==0 in LocalVariableTable?

Let LineBufferedReader pos, limit, buffer be private,
but provide methods to get/set them.

exact->inexact only implemented for RealNums, not other Complex.

Fix scheme-window so #!eof closes window.

Option(s) to control/disable inlining.

Implement source-filename source-line source-column macros.

All function calls in kawa.lib that call standard or library functions
should be resolved statically (inlined or direct methods calls).

Combine primitive field with record facility and define-class.

Provide getopt-long (Guile, check scsh).

Implement SwitchExp;  use it for Scheme case.

Implement full call-cc by re-writing.
This would be slower, so should be optional, probably not the default.

Implement a pretty-printing AWT container.

Complete R4RS procedures.
  trig functions for complex numbers

Complete R5RS number syntax.

Implement system open-input-pipe open-output-pipe close-pipe.

Add a way to specify a load-path (or maybe just use CLASSPATH?).
First seach for loaded files in directory where current file was found.

OTHER:

Provide a way to compile a Scheme program into an Applet class (with
init/start/stor/pain/etc methods).  Also provide a stripped down
"kawa-run.zip", without eval, load, or compiler.

Update to match kawa-tour:
  Vector -> FVector
  SyntaxRule.match should use Pattern.

Should SyntaxRule inherit from Pattern?

Move readSchemeObject readSchemeNumber etc from InPort
to new class(es) Parser:
	class Parser;
	class SchemeReader extends Parser;  // Provides read
	class SchemeParser extends SchemeReader;  // Provides read+rewrite
Move Interpreter.syntaxError to Parser.
Treat ReadError as SyntaxError.
Support warning, error, fatal.
Parser accumulates list of syntax errors.
When done, if errors or warnings, throw SyntaxErrors.
Printing SyntaxError prints error log.

Should print warnings in interactive mode, before evaluation.
Awkward, because ModuleExp.evalModule is used.

Make closure representation consistent with inner classes wrt
use of Attributes (for possible improved debugging).

Optionally issue a warning if a symbol is rebound.

Make kawa.repl -f FILE (or something) work for compiled FILEs.

Use primitive types for expressions when declared/inferred.  Inline arithmetic
when possible.  Integrate native numeric types into numeric tower.
Native ints would have "modular" semantics.  32-bit int would be
converted to an Object as a java.lang.Int, and would overflow by
wrapping around, while gnu.math.IntNum would not wrap around.
Need specification and implementation of mixed modular and
infinite-precision integers.

Inline calls to simple methods, especially builtins.
Ties in with module specifications (to determine which bindings are builtin).

Load should take an optional environment argument.

Quantities:
Arithmetic involving Units should return Units.
Printing a Unit should return something readable, maybe:
  (quantity->unit 1cm) -> "1cm". while 1cm -> "1.0cm".

EVENT CALLBACKS - Proposed design

Syntax:  (listener (EXTRA-INTERFACE ...)
           ((METHOD-NAME+ [EVENT-TYPE])+ ARG ACTIONS ...) ...)

Example:  (invoke component 'addMouseListener
	    (listener ((mousePressed mouseReleases) evt
              (display (list "mouse pressed or released:" evt))))

This creates a new "listener" instance.  The instance has one
method for each METHOD-NAME; the method takes a single argument
of the specified EVENT-TYPE.  The EVENT-TYPE can be left out
in the case of standard java METHOD-NAMES;  for example
if the METHOD-NAME is mousePressed, the implied EVENT-TYPE
is <java.awt.event.MouseEvent>.  When the method is executed,
the actual Event is bound to ARG, and the ACTIONS executed.
(The type is ARG is the least common super-type of all
the explicit or implicit EVENT-TYPES for corresponding METHOD-NAMES.)
The allocated listener instance implements all the interfaces
listed in the EXTRA-INTERFACE list;  if addition, if an EVENT-TYPE
was implied, the corresponding Listener interface is also implied.
(For example a METHOD-NAME of mousePressed implies an EVENT-TYPE
of <java.awt.event.MouseEvent>, and hence an interface of
<java.awt.event.MouseListener>.)
New syntax:
(listener [(EXTRA-INTERFACE ...)]
  ((METHOD-NAME ... EVENT-ARG-NAME [:: EVENT-TYPE]) ...))

SYMBOLS
If we have pre-process environments, (define exit ...) should only re-define
exit in the current environment, not all.

JDK1.2 TASKS - THINGS TO DO ONCE WE REQUIRE JAVA2

Rewrite (make-temporary-file) to use File.createTempFile.

gnu.mapping.Symbol should implement java.util.Map.Entry.

Possibly replace GuiConsole to use JTextPane (or gnu.jemacs.buffer.Window).

JEMACS

clean up function-binding hacks

vertical-motion

Make it so that JEmacs does not require Swing.  There is a start in
that gnu.jemacs.buffer mostly contains toolkit-independentcode, and
gnu.jemacs.swing contains Swing-specific implementations.  This
separation shoudl be finished, and we should add one or more
implementation on other toolskits:
- using Gnome2 (http://developer.gnome.org/doc/API/2.0/gtk/textwidget.html)
text widgets with Pango (http://developer.gnome.org/doc/API/2.0/pango/);
- one that uses the SWT toolkit (http://www.eclipse.org/articles/) 
that is part of the Eclipse project (http://www.eclipse.org);
- one that uses plain AWT;
- and one that works on plain terminals, perhaps using charva
(http://www.pitman.co.za/projects/charva/).
It is important that JEmacs be able to run well using Free Software only,
and it cannot do hat as long it depends on Swing, until there is a
free re-implementation of a suitable Swing subset.
Note that the Buffer class should be a pure "model" which is toolkit
independent:  we want to be able to display the same buffer in both
a Swing Window and a telnet window at the same time.

The JEmacs widgets should be integrated into the gnu/kawa/slib/gui.scm
design.

Should implement Common Lisp-style "type specifiers" and declarations.
This would make it practical to write-lower level code that calls Java
methods directly in ELisp (and Common Lisp), without having to use Scheme.

BENCHMARKS
http://www.ccs.neu.edu/home/will/Twobit/kvwbenchmarks.html
