Created
January 15, 2021 09:49
-
-
Save ShawSumma/37f5a99fea03407a07bba4168c4c02f7 to your computer and use it in GitHub Desktop.
Polyfill for Quest to add "Unary" Object.
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
unary_polyfill_config = { | |
typename = 'Unary'; | |
aliases = { | |
'+@' = '+/1'; | |
'+' = '+/2'; | |
'-@' = '-/1'; | |
'-' = '-/2'; | |
:0 | |
}(); | |
debug = {}; | |
:0 | |
}(); | |
:0.(unary_polyfill_config.typename) = {:0}(); | |
:0.(unary_polyfill_config.typename).'-' = { | |
args = __args__; | |
unary_polyfill_config::debug('-', __args__); | |
if(args.len() == 1, { | |
(args[0]).(unary_polyfill_config.aliases.'-@')() | |
}, { | |
(args[0]).(unary_polyfill_config.aliases.'-')(args[1]) | |
}); | |
}; | |
:0.(unary_polyfill_config.typename).'-@' = { | |
(__args__[0]).'-'() | |
}; | |
:0.(unary_polyfill_config.typename).'+' = { | |
args = __args__; | |
unary_polyfill_config::debug('+', __args__); | |
if(args.len() == 1, { | |
(args[0]).(unary_polyfill_config.aliases.'+@')() | |
}, { | |
(args[0]).(unary_polyfill_config.aliases.'+')(args[1]) | |
}); | |
}; | |
:0.(unary_polyfill_config.typename).'+@' = { | |
(__args__[0]).'+'() | |
}; | |
Number.(unary_polyfill_config.aliases.'+@') = Number::'+@'; | |
Number.(unary_polyfill_config.aliases.'+') = Number::'+'; | |
Number.(unary_polyfill_config.aliases.'-@') = Number::'-@'; | |
Number.(unary_polyfill_config.aliases.'-') = Number::'-'; | |
Number.__del_attr__('-@'); | |
Number.__del_attr__('+@'); | |
Number.__del_attr__('-'); | |
Number.__del_attr__('+'); | |
Number.__parents__.push(:0.(unary_polyfill_config.typename)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment