News for hackers. Stuff that matters.
Re:“Did you mean?” Experience in Ruby by jiggy2011 on Thursday October 23, 2014 @02:15AM (#8496908)
It's not a problem that can be solved for a language like ruby without adding type hinting (and probably interfaces) to the language. FWIW php actually does support this.
Re:“Did you mean?” Experience in Ruby by klibertp on Thursday October 23, 2014 @06:07AM (#8497409)
You don't need (static) type hinting, you can do the same with running a dynamic environment and querying it. That's how it's done in Smalltalk (see Pharo), some Lisps and so on.
Re:“Did you mean?” Experience in Ruby by jiggy2011 on Thursday October 23, 2014 @06:16AM (#8497437)
You could guess, but it wouldn't work in cases where, for example methods are added to a class dynamically and non deterministically as a side effect of some other operation.
Re:“Did you mean?” Experience in Ruby by klibertp on Thursday October 23, 2014 @07:33AM (#8497625)
Do you know how "image based" environments work? In short you live in the same space as your code, so when you write some new method you have access to all the "dynamically and non deterministically" code artifacts. With Smalltalk the code is always being run and you get many useful tools for querying the state of a running system. I know it's hard to believe, but you can get much better completion (not to mention refactoring support) with this approach than you get from static analysis.
Re:“Did you mean?” Experience in Ruby by jiggy2011 on Thursday October 23, 2014 @01:47PM (#8499582)
What if the available methods are potentially different each time the code is run?
Re:“Did you mean?” Experience in Ruby by Rapzid on Thursday October 23, 2014 @04:20AM (#8497172)
Which becomes ironic because you end up writing way more text into the file for phpdoc then you would have if it were a static language to begin with; and you end up treating the variables as static type anyway! :|
Re:“Did you mean?” Experience in Ruby by jiggy2011 on Thursday October 23, 2014 @04:36AM (#8497211)
PHP5 has real type hinting in the language, so you don't need to write any more than you would in Java.
Re:“Did you mean?” Experience in Ruby by TazeTSchnitzel on Thursday October 23, 2014 @09:30AM (#8497978)
And soon it'll even have return typing, should that RFC pass.
Re:“Did you mean?” Experience in Ruby by Rapzid on Thursday October 23, 2014 @04:48AM (#8497242)
phpdoc handles much more than just typing function parameters.
Re:“Did you mean?” Experience in Ruby by debaserab2 on Thursday October 23, 2014 @09:49AM (#8498070)
By far the most common usage is parameters and return values. Even moreso than comments.