After reading Avdi Grimm’s book “Confident Ruby” and my work on CallBaecker and defp I had an Idea for an implementation of soft typing in Ruby. My goal was to build a shorthand for ruby’s conversion methods syntactic similar to other languages. By relying on ruby’s conversion methods I preserved the initial flexibility of ruby. Furthermore I’ve added extended Error messages to ease debuging code. And you can add custom types.
So I’m happy to publish my take on soft typing in ruby.
what it looks like
1 2 3 4 5 6 7 8 |
|
what it translates to
1 2 3 4 5 6 7 8 9 10 |
|
what types are supported
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
In the future I want to add the possibility to use default values with a specified type. If you have any additional types, ideas or enhancements, feel free to open a pull request, issue or leave a comment :)
Head over to the repository.
25-11-2014: adit -> change ‘static typing’ to ‘soft typing’