Consider Static Typing in Ruby
codon.com
Consider Static Typing in Ruby
1–10 of 37 posts
Re: Consider Static Typing in Ruby
#2I can't wait to see how this develops, the simple fact that people inside the Ruby community are willing to put all this on the table is a good sign about the dynamism of all involved.
Re: Consider Static Typing in Ruby
#3Re: Consider Static Typing in Ruby
#4Also isn't Crystal basically a compiled, statically typed version of Ruby?
Re: Consider Static Typing in Ruby
#5If they go this route, I'm sure we'll see some very interesting spins on it.
Re: Consider Static Typing in Ruby
#6First, if I wanted to use a static typed language I have plenty of them to chose from, when I started using Ruby and more right now. One of the reasons I'm using Ruby is that it works well enough without having to tell types to the interpreter (which is already pretty strict about them because - example - it doesn't automatically cast strings and numbers into each other like JS and Perl do).
However, in some very rare cases an object without method M gets passed as argument where an object with method M is expected and the code fails at runtime. It would be nice to catch this in advance, but if the price to pay is to start declaring types like I did in C and Java, no thanks. The problems I had because of dynamic typing have not been big enough to go through all that pain again (and code pollution.)
We'll see what Matz ends up proposing to us, then we'll discuss it. I hope to be able to keep my code free from type declarations and optionally throw in some constraint when I really want to be sure that an object belongs to some class or has some methods. Nothing more.
Re: Consider Static Typing in Ruby
#7http://www.typescriptlang.org/Content/TypeScript%20Language%... (microsoft's javascript with types)
https://code.facebook.com/posts/1505962329687926/flow-a-new-... (facebook's javascript with types)
https://github.com/rwaldron/tc39-notes/blob/master/es6/2015-... Soundscript, google's javascript with types
https://www.python.org/dev/peps/pep-0484/ (planned python with types)
http://www.mypy-lang.org/ (existing python with types)
https://news.ycombinator.com/item?id=8620129 (ruby 3.0 planned with types)
http://crystal-lang.org/ (a good existing ruby with types)
http://hacklang.org/ (facebook's php with types)
http://blog.pascal-martin.fr/post/in-favor-of-rfc-scalar-typ... (php 7 types overview)
https://wiki.php.net/rfc/scalar_type_hints (php 7)
https://wiki.php.net/rfc/return_types (php 7)
https://github.com/rurban/perl/blob/master/pod/perltypes.pod (perl5 inofficial)
Re: Consider Static Typing in Ruby
#8So much of what makes Ruby Ruby is based on dynamic types. Is this going to be optional? I've been moving away from Ruby a bit over the years specifically because I want static typing, but I can't imagine that the majority of Ruby devs feel this way. Also isn't Crystal basically a compiled, statically typed version of Ruby?
Swift has a cool approach to this.
Re: Consider Static Typing in Ruby
#9As a 10 years Rubyist I'm conflicted about this. First, if I wanted to use a static typed language I have plenty of them to chose from, when I started using Ruby and more right now. One of the reasons I'm using Ruby is that it works well enough without having to tell types to the interpreter (which is already pretty strict about them because - example - it doesn't automatically cast strings and numbers into each othe…
Static typing would be a benefit. I think Matz realizes that with the rise of Javascript transpilers Ruby is going to have to fight hard to remain relevant. Give Swift a few more months and there is already a pretty solid language with ruby-like simplicity and a well designed type system.
Re: Consider Static Typing in Ruby
#10So much of what makes Ruby Ruby is based on dynamic types. Is this going to be optional? I've been moving away from Ruby a bit over the years specifically because I want static typing, but I can't imagine that the majority of Ruby devs feel this way. Also isn't Crystal basically a compiled, statically typed version of Ruby?
Not really -- with strong typing you can still use duck typing. Swift has a cool approach to this.
Many people already consider ruby to be pretty strongly typed. It's definitely already more strongly typed than javascript.