On Thursday, January 10, 2013 1:12:14 PM UTC-8, Alex Vinnik wrote:
>
>
> This is expected as Ruby 1.9 defines those methods directly on Symbol, and 
>> Sequel doesn't override methods defined by ruby.
>>
>>
> Jeremy, any specific reason why you would not recommend defining custom 
> Symbol operators in order to workaround Symbol issue? See code below... 
> First obvious reason that struck me that there is no guarantee that the 
> future ruby versions won't have some operators defined. Which sure will 
> break this workaround. Any other factors to consider?
>

I consider overriding methods defined by ruby to be a very poor practice, 
as other code running on ruby 1.9 is going to expect that (:a > :b) return 
false and not an SQL::Expression.

That being said, you are welcome to add the methods yourself if you feel 
like living on the edge.

You are correct that future ruby versions could define operators that 
Sequel currently uses, such as Symbol#+.  If that happens, I'll treat it 
the same way I treated Symbol#< when ruby 1.9 added it (keeping existing 
support on old versions, removing it from the new version).

Note that Sequel 4.0 is not going to load the core extensions by default, 
it'll be something you have to manually load.  Additionally, I'm strongly 
considering removing Symbol#(<,>,>=,<=,[]) methods from the core extensions 
even on ruby 1.8 starting in Sequel 4.0.  I like ruby 1.8 a lot and Sequel 
will continue to support it indefinitely, but encouraging any use of those 
methods will just make it harder to update apps to more modern versions of 
ruby.

I will state for the record that I think the Symbol#(<,>,>=,<=,[]) methods 
should not have been added to ruby.  Symbol#<=> makes sense to allow the 
sorting of arrays containing symbols, but taking substrings of symbols and 
comparing two symbols lexicographically don't seem to have much use, IMO.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/tXPKgQbfMD8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to