master caster
Oct. 11th, 2004 02:02 amFrom Pierce's Types and Programming Languages:
"There are three rules for type casts: in an upcast the subject is a subclass of the target, in a downcast the target is a subclass of the subject, and in a stupid cast the target is unrelated to the subject."
"There are three rules for type casts: in an upcast the subject is a subclass of the target, in a downcast the target is a subclass of the subject, and in a stupid cast the target is unrelated to the subject."
no subject
Date: 2004-10-11 12:21 am (UTC)Suppose a functional language were to replace concrete types with signatures, so that "int" would simply be a signature with a standard presumed implementation using machine integers. Is there any use for subtyping in such a language?
I also wonder how such a language might express tagged sums (which would presumably still be useful for structure implementation)?
Your disciplined discipline,
J.
no subject
Date: 2004-10-11 06:26 am (UTC)One could characterize all stupid casts in java as an upcast to java.lang.Object, followed by a the relevant downcast. This would make it possible to eliminate all stupid casts in java, which is clearly a contradiction.
Proof by Contradiction.
special guest replier!
Date: 2004-10-11 06:30 am (UTC)As for the use of subtyping, I personally wouldn't want to have it, but there are standard treatments of subtyping for lambda calculus.
no subject
Date: 2004-10-11 07:49 am (UTC)(float) ThomasPyncheonany less stupid.Re: special guest replier!
Date: 2004-10-11 07:57 am (UTC)Re: special guest replier!
Date: 2004-10-11 08:02 am (UTC)method case : forall V, (T -> V) -> (U -> V) -> V
no subject
Date: 2004-10-11 09:05 am (UTC)no subject
Date: 2004-10-11 09:58 am (UTC)-- IEEE Thomas Pynchon
Re: special guest replier!
Date: 2004-10-11 10:12 am (UTC)casepart of the signature, but it's clearly the sensible move. Maybe a record type instead of a curried list, since ordering is a bit arbitrary -- so, in SML syntax:datatype foo = bar of X | baz of Yval case: { bar: X -> 'a, baz: Y -> 'a } -> foo -> 'a
no subject
Date: 2004-10-13 03:59 pm (UTC)no subject
Date: 2004-10-13 04:56 pm (UTC)Regardless of the answer to the above, I am impressed that {cognitive science, functional programming, libertarianism, taoism} are all in the intersection of our interests.
no subject
Date: 2004-10-14 12:58 am (UTC)