> Look under 'block' not 'code block'.
Ahh. "Blocks" as in "Proc's and blocks".
> That is not really the issue, remember I was talking to a
> beginner. 12.to_s means it is Integer's responsibility to
> convert itself to a String str(12) means it is Kernel's
> responsibility to convert Integer's to Strings
Do you really think a beginner cares about that or even has any idea
what you are talking about?
> the second just does not feel OO to me.
What about when you write:
puts result
input = gets
p = lambda {"hello world"}
printf("%.2f \n", 4.56789)
require "somefile"
sleep(2)
Do you avoid those 'global' method calls because they look too much like
str(12)? Or, to maintain your OO purity do you write things like:
Kernel.puts "hello world"
> I give it to you for Syntax errors, but when it come to Stack Traces
> OMG Ruby beats Python by magnitudes.
def func1
func2
end
def func2
puts y
end
func1
ruby:
-----
r8test.rb:5:in `func2': undefined local variable or method `y' for
main:Object (NameError)
from r8test.rb:2:in `func1'
from r8test.rb:7
python:
-------
Traceback (most recent call last):
File "6test.py", line 8, in ?
func1()
File "6test.py", line 2, in func1
func2()
File "6test.py", line 5, in func2
print y
NameError: global name 'y' is not defined
I don't see any substantive difference, but to my eye the python output
looks more orderly and is easier to read.
> Personally, I find Pythons documentation boring and dull,
> but good if you are familiar with programming (and English).
That's more credit than I'd give it!
--
Posted via
http://www.ruby-forum.com/.