3 ms·
I find that putting the method signature at the end of the method definition can become unreadable pretty fast. Also, the fact that it doesn't offer any perform
by anaolykarpov 12y ago
I find that putting the method signature at the end of the method definition can become unreadable pretty fast. Also, the fact that it doesn't offer any performance improvement (most probably, this will actually degrade performance) makes me see this as a cool trick, but not really recommended in production.
I like the aproach Perl 6 took on gradual typing. You can read about it in this article which computes fibonnaci's number:http://blogs.perl.org/users/ovid/2015/02/avoid-a-common-software-bug-by-using-perl-6.html http://blogs.perl.org/users/ovid/2015/02/avoid-a-common-soft...
The only reason I wait for the next winter to come is because Perl6 will be production ready by then as Larry Wall announced at FOSDEM this year.
- arnvald 12y agoSince Ruby 2.1 (IIRC), method definition returns symbol, therefore it's possible to something like typesig def meth(arg) arg end, [Numeric] => Numeric Although it's still end of the method, it already suggests that signature will be there