Last active
November 30, 2020 17:06
-
-
Save radgeRayden/9f2aae8419229a1baf9f578426707047 to your computer and use it in GitHub Desktop.
semantically-bind-types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
semantically-bind-types c2.v vec2 | |
inline "conv-to" (self) | |
vec2 self.x self.y | |
inline "conv-from" (other) | |
c2.v (unpack other) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline semantically-bind-types (T1 T2 implyf rimplyf) | |
typedef+ T1 | |
inline gen-op (op) | |
inline (lhsT rhsT) | |
static-if (lhsT == this-type) | |
inline (a b) | |
op (imply a T2) b | |
elseif (rhsT == this-type) | |
inline (a b) | |
op a (imply b T2) | |
inline __imply (selfT otherT) | |
static-if (otherT == T2) | |
implyf | |
inline __rimply (otherT selfT) | |
inline (other) | |
rimplyf (imply other T2) | |
let __+ = (gen-op +) | |
let __- = (gen-op -) | |
let __* = (gen-op *) | |
let __/ = (gen-op /) | |
let __// = (gen-op //) | |
inline __repr (self) | |
.. (repr (imply self T2)) | |
default-styler style-operator ":" | |
default-styler style-type (tostring this-type) | |
unlet gen-op |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment