Arbitrary abbreviations in phobos considered ridiculous

Nick Sabalausky a at a.a
Fri Mar 9 13:21:47 PST 2012


"Ary Manzana" <ary at esperanto.org.ar> wrote in message 
news:jjdqe4$1oeb$1 at digitalmars.com...
>
> Indeed, count can be used to count elements:
>
> ruby-1.8.7-p352 :002 > [1, 2, 3, 3, 3].count 3
>  => 3
> ruby-1.8.7-p352 :004 > [1, 2, 3, 3, 3].count &:odd?
>  => 4
> ruby-1.8.7-p352 :005 > [1, 2, 3, 3, 3].count { |x| x <= 2 }
>  => 2
>

Interesting idea.

>>
>> IMAO, this sort of "write your mind and somehow it just works" thing
>> only encourages lazy programming (guessing what something does without
>> knowing for sure, and copy-n-pasting code without understanding it,
>> which leads to bit rot and hideous patchwork code that houses all sorts
>> of subtle bugs and corner-case failures).
>
> We also write lots of tests in Ruby. :-P

Writing plenty of tests is good no matter what, but it's an inferior 
substitute for proper compile-time checks. Not that that's applicable to 
this "count vs length vs size" subdiscussion, of course. Just a general 
comment on the dynamic world's fairly common "lots of tests" excuse.




More information about the Digitalmars-d mailing list