On 3/8/12 8:55 AM, Steven Schveighoffer wrote:
On Wed, 07 Mar 2012 21:14:34 -0500, Ary Manzana <a...@esperanto.org.ar>
wrote:

The problem is not mistaking it with something else. The problem is
when you want to write it. In Ruby my mind works like this:

Mind: "How would I get a span for 5 seconds?"
Mind: "Let's try 5.seconds"
Mind: "Wow, it works!"

I'm trying to remember cases when I just wrote what my mind thought it
was correct and I was *so* surprised it worked out of the box in Ruby.
Like writing array.last, and get it to work, instead of
array[array.length - 1]. But in D, from the docs
(http://dlang.org/arrays.html )

bar[$-1] // retrieves last element of the array

I read: bar dollar minus one wait what??

array.back;

http://dlang.org/phobos/std_array.html#back

This is the issue with "intuition". It's easy to say, "hey I guessed
right in Ruby! Ruby must be more intuitive!". But if you were someone
who knew the range interfaces, wouldn't you try array.back in Ruby and
say "well, obviously D is more intuitive, it knew what I wanted without
even looking up the docs!"

You are never going to come up with something that's *perfectly*
intuitive for everyone in every situation.

Thanks, I didn't know that function.

The problem is, you don't go saying "Hey, I want the back of an array", (or the back element of an array) you usually say "I want the last element of an array" (or range, whatever). I can't understand why "back" was used instead of last.

Reply via email to