This is the mail archive of the kawa@sourceware.cygnus.com mailing list for the Kawa project. See the Kawa home page for more information.
At 14:52 11.03.99 -0800, White wrote: >At 12:09 PM 3/11/99 -0800, Per Bothner wrote: >That to me is the best form as it is most in keeping with LISP syntax. >I believe though that it should be: > (let (((<int> i) 10)) ...) Although I believe (let ((i <int> 10)) ..) is easiest to write I agree that (let (((<int> i) 10)) ...) perhaps is most Lispish and practical for analysis purposes. >OTOH, what about aligning this feature with Common Lisp syntax: > > (let ((x 10) (y 20) ...) > (declare (type integer x y) ...) > ...) The nice thing about declarations is the possibility of adding local declarations without adding a new binding, i.e. the locally-form of Common Lisp. Consider a typical use of instanceof in Java: if (a instanceof Vector) ((Vector)a).addElement(b); Why should I have to cast a when I've just checked the type? Similarly, for Kawa-code it code be useful to be able to express that within a for a variable holds a value of a more specific type, to limit the need for type checking. A useful macro if-instance-of could be written as: (defmacro if-instance-of ((var type) then else) `(if (instance-of? var type) (locally (declare ,var ,type) ,then) ,else)) Since I'm interested in making a more Java-like scripting language, this declaration mechanism should ideally be built into the gnu-package. Hallvard Hallvard Trętteberg, Stipendiat ved Institutt for Datateknikk og Informasjonsvitenskap (IDI) Fakultet for Fysikk, Informatikk og Matematikk (FIM) Norges Teknisk-Naturvitenskapelige Universitet (NTNU) Kontor: F-262, Nye Elektro, Tlf: +47 7359 3443, Fax: +47 7359 4466