logoalt Hacker News

ceritiumtoday at 6:51 PM1 replyview on HN

I love it, I liked what dry-initializer and dry-struct do, and I wanted something similar but simpler than RBS or Sorbet.

I tried once myself to implement something like lowtype, but without success.


Replies

hakunintoday at 8:48 PM

I built portrayal[1] (a much simpler replacement for those dry libs), and was also experimenting[2] with runtime-enforced types based on this lib.

My general thoughts is that declaring types in Ruby is unnecessarily complicated, because you're basically just running values through pieces of boolean logic, and nothing else. Might as well make that explicit, which is what my experiment did. I didn't however publish the types library, but the concept was proven.

[1]: https://github.com/maxim/portrayal

[2]: https://max.engineer/portrayal-guards-poc