Skip to content

Instantly share code, notes, and snippets.

@radgeRayden
Last active November 30, 2020 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radgeRayden/9f2aae8419229a1baf9f578426707047 to your computer and use it in GitHub Desktop.
Save radgeRayden/9f2aae8419229a1baf9f578426707047 to your computer and use it in GitHub Desktop.
semantically-bind-types
semantically-bind-types c2.v vec2
inline "conv-to" (self)
vec2 self.x self.y
inline "conv-from" (other)
c2.v (unpack other)
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