On Sun, Mar 1, 2015 at 11:49 PM, Keean Schupke <[email protected]> wrote:
>
> On 2 Mar 2015 07:32, "Matt Rice" <[email protected]> wrote:
>>
>> On Sun, Mar 1, 2015 at 11:17 PM, Keean Schupke <[email protected]> wrote:
>> >
>> > On 2 Mar 2015 04:10, "Matt Rice" <[email protected]> wrote:
>> >>
>> >> On Fri, Feb 27, 2015 at 5:21 AM, Keean Schupke <[email protected]>
>> >> wrote:
>> >> > The problem with casts is they can fail, even this :
>> >> >
>> >> > case t of
>> >> >     (x :: X) -> ...
>> >> >     otherwise -> ...
>> >> >
>> >> > Would be better, but I would prefer to constrain 't' to a type-class.
>> >>
>> >> I don't exactly see a cast there, in general since I apparently didn't
>> >> make it clear the thought was that this would be implemented in the
>> >> compiler, as part of a is_it_safe_cast_call_sandwich(sym,type), with
>> >> the object header id being either the tag of a tagged union, or some
>> >> form of type representation mechanism.
>> >
>> > I guess there is some confusion here. What is an is it safe cast call?
>> > With
>> > a case statement there is a clear failure path, are you suggesting
>> > failure
>> > to cast is an exception?
>>
>> a compiler error, that is we can consider it one of two ways, it's
>> either converting a value of SomeType to to a value conforming to
>> SomeTypeConstraint, or a function expecting a
>> f(arg:SomeTypeConstraint) to a function accepting a SomeType as an
>> argument, so it checks that the type conforms to the structure before
>> static casting.
>
> Subtyping like this is only needed for dynamic runtime stuff. If the
> compiler can statically determine the exact type you don't need a super
> type, you just rely on parametric polymorphism and type - classes.

Right, which is why i need a 2nd mechanism like tagged unions and/or
type representations to solve dynamic runtime stuff problem, there is
a lingering question I have as to why it casts on the object header
id, rather than using tagged union and normal types (since I believe
shap said that none of them overlap),
I imagine this has more to do with implementation efficiency than it
has to do with static variable effects (or at least I hope :),

but I believe that this is 2 distinct problems, can a type conform to
2 types, and thus share code & symbols, and the runtime identification
of types, anyhow I'm really not exactly clear on the goals (or what
exactly we wish to retain out of subtyping in this)

Anyhow the goal here was to try and define this in a way that the
assembly can generate something resembling the existing
implementation.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to