Closed alexgrejuc closed 3 years ago
Ahhh, didn't think of that, good catch. I'm a fan of the first option, but that means we will have to make a change to the typechecker to recognize explicitly defined values for a type syn, but this comparable to just defining new types, instead of using a synonym (like mentioned in #115). The approach we take will probably be with regard to how we handle that. This might be a good one to discuss in a meeting.
I think this should be allowed. I don't recall why it was cast as illegal.
-- Martin
On Aug 17, 2020, at 12:00 PM, Alex Grejuc notifications@github.com wrote:
Previously this was allowed. I heard from @montymxb that this was discussed and changed at some point this summer. Right now, the type system still allows it, but it results in a runtime error. I think we should remove the runtime error and allow it.
I see two options for doing so:
• only allow if there exists a type that contains the symbol and the other btype (e.g. Int & {A} allows A == 1 but not B == 1) • always allow it The example below illustrates why I think it should be allowed in some form:
game G
type Position = (Int, Int) type Board = Array (3,3) of Int & {X}
b : Board b!(x,y) = X
isX : (Board, Position) -> Bool isX(b, p) = b ! p == X
Another common scenario is comparison with Empty.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Closed because symbolic values can be compared to other values provided there is a type that contains them both.
Previously this was allowed. I heard from @montymxb that this was discussed and changed at some point this summer. Right now, the type system still allows it, but it results in a runtime error. I think we should remove the runtime error and allow it.
I see two options for doing so:
btype
(e.g.Int & {A}
allowsA == 1
but notB == 1
)The example below illustrates why I think it should be allowed in some form:
b ! (1,1) == X
results inTrue
and every other position results in a runtime error.Another common scenario is comparison with
Empty
.