Skip to content
Snippets Groups Projects
Commit 764ec478 authored by dtc's avatar dtc
Browse files

Implement a specializing CONS class as per issue CONS-TYPE-SPECIFIER:ADD.

The new cons-type which maintains the specialised CAR and CDR types:

o Typep recurses, checking the respective car and cdr specialisations;
  two cons-types are type= if both their car and cdr types are type=.

o Subtypep recurses, applying subtypep to the respective car and
  cdr types. If both sub-tests return true then the cons test returns
  true with a win only when both sub-tests win. If either sub-test
  returns false then the cons tests returns false with a win if either
  of sub-tests win.

o Type-intersection is applied to the respective car and cdr types,
  and wins if both win.

o The type-union of two cons-types handles cases for which either the
  respective car or cdr types are type=, in which case type-union is
  applied to the other type. This avoid returning an overly general result.

o Ctype-of a cons object simply returns (cons * *); and does not attempt
  to recurse.

o The compiler recursively checks the specialised type of the cons-type,
  which allows it to also use this type information to derive the result
  type car and cdr. Inline code is currently only generated when
  natively compiling.
parent addd3ff3
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment