compiler types: records / collections interaction

Al <[email protected]>
Newsgroups gmane.lisp.scheme.chicken
Message-ID <[email protected]>
Suppose I need a record of a record type myrec, and collections 
(vectors-of, lists-of and hash-tables) with values myrec.


What combination of

* define-record-type (srfi-9, srfi-99, chicken define-record, whatever) and

* (declare type ...)

can I use to inform the compiler that (for collections of myrec) 
vector-ref returns myrec's (likewise list car/cdr, hash-table-ref)? And 
that it needs not emit any instance-type-checking code for objects 
extracted from such collections?


Furthermore, how can I see what the compiler thinks of a given 
identifier? I've used 'csc -ot' but it only emits types for some 
identifiers. Maybe it inlines others, I don't really know.


Separately, how can I tell the compiler that fields in these records 
have certain types? Add type declarations for the implicitly-defined 
per-field accessors and mutators?


I've tried unwrapping collections of myrec, and also myrec fields, and 
it seems to make a huge difference in the speed of compiled code. 
Presumably because I don't know how to tell the compiler to omit type 
checking in "safe" cases. I know I could use some of the more aggressive 
optimization levels, but I don't really want to compile unsafe code 
everywhere, just where  I'm using the correct types.


Thanks,

Al
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.