Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rethink and rework subtype? #38

Open
hannesm opened this issue Nov 15, 2011 · 2 comments
Open

rethink and rework subtype? #38

hannesm opened this issue Nov 15, 2011 · 2 comments

Comments

@hannesm
Copy link
Contributor

hannesm commented Nov 15, 2011

connected to issue #37 it worries me a bit to have different implementation for subtype? at compile time and runtime, in addition to that there is a special subtype for type inference.

This needs some research, hopefully with a test library for types (specifically: test without optimizations, test with optimizations, test runtime and compile time type relationship). Somehow subtype? is also connected to loose mode (from dylan/union.dylan [method type-union]):
/* Illegal for loose Mode
subtype?(t1, t2)
=> t2;
subtype?(t2, t1)
=> t1;
*/
instead a new generic method, merge-type is introduced and used here.

@hannesm
Copy link
Contributor Author

hannesm commented Aug 24, 2012

so, there's subtype? in library dylan, which defines the run-time subtype relation. then there is ^subtype? in dfmc-modeling, which contains the compile-time relation. and the type-estimate-subtype? relation in dfmc-typist (used for type inference).

these are inconsistent. take for example:

define method subtype? 
    (c :: <class>, subc :: <subclass>) => (result :: <boolean>)
  c == <class> & subc.subclass-class == <class>
end method;

and

define method ^subtype? 
    (t :: <&type>, subc :: <&subclass>) => (result :: <boolean>)
  ^subtype?(dylan-value(#"<object>"), subc.^subclass-class)
    & ^subtype?(t, dylan-value(#"<class>"))
end method;

of which I can't find a version in dfmc-typist....

Upcoming questions:

  • how to define these in dfmc so they get emitted into the Dylan library directly, and we have a consistent relation?
  • where is subclass defined and its typing rules?

@hannesm
Copy link
Contributor Author

hannesm commented Aug 24, 2012

oh, and there is another -- subjunctive-subtype? in the dylan library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant