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. _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
