From: Aleks Kissinger Date: 2006-07-29T01:28:54+09:00 Subject: Re: Symbols are your friends > Because I only think the #to_x methods are directly related to types. > They even have more nuances than class-based types; there's a difference > between defining #to_s and defining #to_str, for example. > In the spirit of making sure I understand, and perhaps explaining this to anyone else that may be confused, the difference in these two kinds of methods: If an object _can_ be represented as an integer in some cases (e.g. a string, which could be set to something like "12"), it implements to_i. If an object _is_ a natural representation of an integer, (like roman numerals, as the example the Pickaxe gives), it implements to_int. So this makes sense, though nothing about the naming convention of these methods makes this particularly clear. However, this brings up the question: If something acts exactly like an integer method-wise, whats the benefit of explicitly calling to_int? This seems like a non duck-typey thing to do. Aleks