On Feb 29, 2008, at 3:28 PM, Trans wrote:

>
>
> On Feb 29, 7:33 am, Florian Gilcher <f... / andersground.net> wrote:
>> On Feb 29, 2008, at 1:20 PM, Trans wrote:
>>
>>
>>
>>> On Feb 24, 4:43 pm, Gary Wright <gwtm... / mac.com> wrote:
>>
>>>> Facets defines Hash#- based on [key,value] pairs and not keys.  An
>>>> argument can be made for either approach but you can't integrate  
>>>> code
>>>> bases that have different expectations for Hash#-.
>>
>>> BTW, there is a reason for that. You can do:
>>
>>> ahash - otherhash.keys
>>
>>> T.
>>
>> That does not hurt the argument. If you expect this, you are fine.
>> If you define or expect a different interpretation, you are in a  
>> world
>> of pain.
>
> Sure. I was just pointing out why that particular functionality was
> chosen, vs. the other reasonable suggestion. That's another benefit of
> using a common library --you get a lot of collective minds evolution
> behind things.
>
> T.
>

I agree. But I think facets is a bad example, because the whole  
premise of facets is extending core classes. Everybody that uses it is  
aware of it. ActiveSupport is much more of a problem because it is  
part of a library that is not advertised as a library extending Ruby.

Whats much more problematic is a library that does arbitrary things  
and extends Object and/or Module just for the sake of simplicity and  
cuteness. Perhaps without letting you know and without advertising it.  
I ran into that case multiple times and after another debugging  
session the only thing that stays is the anger :).

I agree with the fact that everybody should write the code that he  
likes. But good (public) library code  does not mess with the  
sentiments of other programmers too much. A nice way that was proposed  
is to have an opt-in way for those behaviours. So nobody can complain  
that he didn't know about this fact. For example:

==== code ====
require 'some_csv_lib'

CSV.to_csv(array) #standard way

array.to_csv #error

CSV.furry_cuteness :on
array.to_csv #just fine
==== code ====

I for example don't use RSpec because it changes Object (and by that,  
the testee). Thats my personal opinion. I understand everybody that  
says that I'm thinking too strict. But i'm just fine with using  
assert.  You can do TDD without explicitly saying "should". Your  
mileage may vary :).[1]

Perhaps, this is also a matter of communication from library author to  
user.

Greetings
Florian Gilcher

[1]: Fine print: no, I do not wish to discuss this stance. This is  
just an example. Don't even try.

P.S.: Does anybody know how I get Apple Mail to wrap after ~78  
characters line width when composing a mail?