Hi,
In message "Re: Conventions in ruby and the principle of least surprise"
on Tue, 27 Jan 2009 11:11:55 +0900, Einar Boson <einarmagnus / tistron.se> writes:
|do..end vs. {}
|I find that rather annoying but I guess it's to be able to write things
|like
|
|save_block ["name1_long", "name2_long", "short"].find {|n| n.size <=
|5}.to_sym do
| puts "hello!"
|end
Correct.
|Anyways. More serious, in my oppinion, is the fact that Array#insert and
|String#insert are destructive without having an exclamation mark. Why is
|that? I really do not expect them to change their owner.
|seriously, wtf? Why not `insert` and `insert!` that behave as expected?
The bang (!) does not mean "destructive" nor lack of it mean non
destructive either. The bang sign means "the bang version is more
dangerous than its non bang counterpart; handle with care". Since
Ruby has a lot of "destructive" methods, if bang signs follow your
opinion, every Ruby program would be full of bangs, thus ugly.
matz.