Proposal: Type checking for variables inside of methods #300
denis-mueller
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If I understand the docs correctly, this gem allows me to enforce types for params of the constructor (initialize method) of an object. But if I'm not missing anything, it's currently not possible to enforce the type for a variable inside a method, except for manually doing something like
It would be amazing, if there was a concise syntax to
a) check if a variable matches a literal type. do nothing if it matches, but raise if it doesn't match
b) try to coerce a variable into a type. do nothing if it works, raise an error if it's not possible to coerce
here a few ideas I had
Now my questions @joeldrapper
Beta Was this translation helpful? Give feedback.
All reactions