I honestly consider the outright statements against with to be
overboard. I've been using the with statement quite reliably inside my
code at work. I think the issue is misuse of with. One shouldn't go
using with in the intent to do `with(foo) {bar = 'baz';}` and have
foo.bar modified. In fact I don't believe with should be used with any
intent to set at all (except for the case where Bar exists in foo, and
you want to set .someprop on Bar, that is a different case). With is
quite effective in use for importing things like libraries into local scope.
ns.my.lib; Defines camelCaseMe, and runMe; You can use `with(ns.my.lib)`
with the intent to allow you to use camelCaseMe and runMe in the local
scope.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://nadir-seen-fire.com]
-Nadir-Point & Wiki-Tools (http://nadir-point.com) (http://wiki-tools.com)
-MonkeyScript (http://monkeyscript.org)
-Animepedia (http://anime.wikia.com)
-Narutopedia (http://naruto.wikia.com)
-Soul Eater Wiki (http://souleater.wikia.com)
Aleem B wrote:
>> I guess it's a bit like the 'with' operator ?
>>
>
> avoid 'with'
>
> http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/
>
>
> and more specifically, crockford's nail in the coffin
>
> http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-720
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---