[bitc-dev] Change to type declarations

EricNorthup digitale at digitaleric.net
Mon Oct 18 12:26:41 EDT 2004


> I've been reading some papers, and I want to revise the way we are
> declaring types.
> 
> In procedures, eliminate the type declarations in the formal parameters
> in favor of DECLARE forms:
> 
> (defun fib (x)
>   (declare (type int32 x))
>   (+ (- x 1) (- x 2)))

s/"fib"/"two_x_minus_three"/   :p

(defun fib (x)
  (declare (type uint32 x))
  (if (> x 1)
    (+ (fib (- x 1)) (fib (- x 2))
    (1)))

?

Although I understand reasoning about the recursion here may require a
bit more work.  Fib may not be the best "hello world" program (the
example in the spec also gets this wrong BTW).

> 
> and in expression context, THE forms:
> 
>    (let ((a (the int32 3))) ..body..)
> 
> My intention is that these should always be permissible, but they should
> be largely optional, and that we will go to a type inferencing engine.
> 
> HOWEVER, the type inference engine will operate by inserting these forms
> so that the types of all variables can be explicitly determined by the
> phase that builds the datatype.
> 
> The motivator for this is that in level-1 BitC we want to introduce
> things like CONS, and to do so we will need parametric polymorphism.

parametric polymorphism:  is this like "CONS<int32>" or like ML's "
type-t list" or something else entirely?

--Eric


More information about the bitc-dev mailing list