Ok.. so yesterday was day 2. Now I’m 120 pages in. Yay.

I was happy to see that I’m not the only one with the scoping issue I had yesterday. Seems it’s a well known issue, although sadly, it doesn’t seem that there’s a resolution in sight. The book assures me that it isn’t really a big problem.

Another question mark for me is the idiom they show using ranges in a loop.

file = File.open("ordinal");
while line = file.gets
puts(line) if line =~ /third/ .. line =~ /fifth/
end

produces:

third
fourth
fifth

And unless there’s some kind of crazy magic going on, what I’m disappointed in is that there’s no mention of performance implications if the ordinal file is a million lines long - this idiom would seem to loop through all million lines. I’ve seen it a few times in the book and no mention of this concern or any special Ruby magic that makes it magically know that it was time to exit the loop. It’s a cool feature for sure, but it still needs some caveats.

I also want to do a little more research, but I wonder how all this everything is OO affects performance. Java wussed out of that for numbers due for just that reason, I wonder how Ruby solves it.

I still really like the language, just posting idle questions and concerns that came into my mind reading this book.

← newer Breakfast Links: Street Art, Ear Wax & Expungement  ↑  Photoshop Online older →

TwitterCounter for @nybble73