On 3/8/12 4:04 PM, Jonathan M Davis wrote:
On Thursday, March 08, 2012 06:55:17 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.
Yeah. I don't understand how anyone can expect to just write code and have it
work without looking anything up.
I just stumbled upon this again in Ruby. I have a time object. I want to
know if it's in the past. I wrote:
time.past?
it worked! :-)