This is the mail archive of the mailing list for the Kawa project. See the Kawa home page for more information.

[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: type specifiers for local variables

At 13:16 15.03.99 -0700, you wrote:
>>OTOH, what about aligning this feature with Common Lisp syntax:
>>     (let ((x 10) (y 20) ...) 
>>          (declare (type integer x y) ...)
>>          ...)
>Please do not do this.  Putting the declaration with the variable
>makes it easier (to me at least) to manipulate the code.

I agree that declarations should be associated with the variable. However,
the suggested syntax does not allow a declaration without introducing a
new binding. In some cases it is important to be able to add declarations
around a form, to say that within this form a variable is known to refer to
a more specific type than previously declared. Perhaps we can introduce
a declare syntax specifically for this:

(let (((a <number>) (read-a-number)) ... )
   (if (instanceof? a <integer>)
      (declare ((a <integer>) ... )

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