[bitc-dev] constraining bitc's type system
Swaroop Sridhar
swaroop at cs.jhu.edu
Mon Sep 18 15:23:54 CDT 2006
Sam Mason wrote:
> The main thing I was thinking of originally was being able to have some
> sort of structure like:
>
> (defstruct (foo 'a)
> x:bool
> y:int32
> z:'a
> p:(foo 'a))
>
> and being able to know that if I have a function like:
>
> (define (fn foo:(forall ((refType 'a)) (foo 'a)))
> (if (foo.x)
> (fn foo.p)
> (foo.z)))
>
> hope that I've got the annotation correct, it's supposed to mean that
> the parameter z of foo is a reference type. I would not expect fn to be
> polyinstantiated and is also what I mean by having only the polymorphic
> members boxed. The other types would remain unboxed and available for
> use without polyinstantiation of the function.
The correct annotation for what you mean is:
(define foo:(forall ((refType 'a)) (fn (foo 'a) 'a))
... )
and I think this will achieve what you want.
> I think that the sort of algorithms you are thinking about though are
> the more generic containers that don't work very nicely in C without lots
> of type casting.
I am a little confused about this paragraph. Are you talking about the C
code emitted by the compiler? Or, are you saying that this cannot
otherwise be done from C ? Or, are you concerned about linking C code
with instantiated procedures?
Swaroop.
More information about the bitc-dev
mailing list