On Wed, Dec 5, 2012 at 10:33 PM, Bill Frantz <[email protected]> wrote:

> On 12/5/12 at 1:50 AM, [email protected] (Jussi Kalliokoski)
> wrote:
>
>  I personally think returning `this` in absence of any meaningful value
>> (and
>> chaining in general) is a bad pattern.
>>
>
> </lurk>
>
> I have to agree with Jussi here. Whenever I consider chaining using the
> returned values from the various things called, my programming paranoia
> hair stands on end. Let me try to explain:
>
> Whenever I program, I try to trust as little code as possible. With
> chaining, there are two possibilities for getting the wrong answer in the
> returned value:
>
>   * I or someone else wrote it, but screwed up,
>   * Someone hostile wrote it and is trying to trip me up.
>
> If there is a language construct that allows chaining -- like the Pascal
> "with" construct -- then I am only trusting the language*, not other
> fragments of programs. If I depend on things I call returning the correct
> "this", then I am depending on them and my dependency set is a lot larger.
> A larger dependency set makes me nervous.
>
> Cheers - Bill
>
> * For the really paranoid, minimizing the parts of the language depended
> on is important. Not all JS implementations behave the same way in the
> corner cases.
>

Again, I reject the notion that "someone might screw up" is a valid
argument for this, or any, discussion. It's one thing to be aware of the
potential for misuse, but entirely another to succumb to "fear driven
design".

Rick
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to