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

Just as an informational aside, the original Dylan language had to deal
with this issue since it was based strongly on Scheme's syntax. Although
its object system is much like CLOS, the designers seemed to stick more to
the Scheme spirit than that of CL. They used the extra parentheses as in
Per's first example.

While I agree it may seem like many more parentheses to read, a let example
might compound that appearance. In other constructs it doesn't seem so bad.

;; example prefix-dylan definition
(define-method append-char-to-string 
    ((in-char <character>)
     (in-string <byte-string>) #values (result <byte-string>))
        (bind (((temp-string <byte-string>) " "))
                (element-setter in-char temp-string 0)
                (concatenate in-string temp-string)))

This example includes parameter bindings, and local bindings [bind was
prefix-dylan's equivalent to let]. The #values keyword indicated the return
type. I'm not suggesting that you follow the Dylan model, just showing that
it was an approach for adding type information to a Scheme syntax.
Ironically the infix-dylan language uses the i :: <int> type syntax.

Other comments on this topic have mentioned that the (<int> i), or
specifier first style would be in keeping more with lisp style. However, I
submit that most (if not all) Scheme constructs are that of binding, value
 (define x 10)
 (let ((y 10)) (+ y x))

I would further venture that the type information is more related to value
than binding. Thus it is more Scheme-like to preserve the binding, value
style by having the specifier follow the binding name. This is, of course,
my humble and unqualified opinion.

((lambda (args) (display args)) "
   Robert D. Skeels       | Los Angeles illustrator, designer   | |")