Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #12787 > unrolled thread

Adding new method to existing object

Started bycezary.tomczyk@gmail.com
First post2012-03-16 03:56 -0700
Last post2012-03-18 04:27 -0700
Articles 3 on this page of 23 — 5 participants

Back to article view | Back to comp.lang.javascript


Contents

  Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-16 03:56 -0700
    Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 04:50 -0700
      Re: Adding new method to existing object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-16 15:31 +0100
        Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 11:51 -0700
          Re: Adding new method to existing object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-17 00:10 +0100
            Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 17:25 -0700
              Re: Adding new method to existing object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-17 02:04 +0100
                Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 18:15 -0700
      Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-16 10:18 -0700
        Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 11:56 -0700
        Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 13:01 -0700
          Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-17 04:58 -0700
            Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-17 16:04 -0700
              Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-18 04:24 -0700
                Re: Adding new method to existing object John G Harris <john@nospam.demon.co.uk> - 2012-03-18 13:16 +0000
    Re: Adding new method to existing object John G Harris <john@nospam.demon.co.uk> - 2012-03-16 17:09 +0000
      Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-16 10:46 -0700
    Re: Adding new method to existing object Scott Sauyet <scott.sauyet@gmail.com> - 2012-03-16 13:43 -0700
    Re: Adding new method to existing object Scott Sauyet <scott.sauyet@gmail.com> - 2012-03-16 20:15 -0700
      Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-17 05:17 -0700
      Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-17 05:24 -0700
        Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-17 16:16 -0700
          Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-18 04:27 -0700

Page 2 of 2 — ← Prev page 1 [2]


#12847

Fromcezary.tomczyk@gmail.com
Date2012-03-17 05:24 -0700
Message-ID<8579633.960.1331987053327.JavaMail.geo-discussion-forums@vbux23>
In reply to#12842
W dniu sobota, 17 marca 2012, 04:15:52 UTC+1 użytkownik Scott Sauyet napisał:
> CT wrote:
[...]
>     //~ I just attach this to the global namespace here instead
>     //~ of using the `global` variable to reference `this`.

As for global variable with this object I just use now:

(function(){ return this || (1,eval)('this') })()

based on article http://perfectionkills.com/unnecessarily-comprehensive-look-into-a-rather-insignificant-issue-of-global-objects-creation/

-- 
Regards,
CT

[toc] | [prev] | [next] | [standalone]


#12861

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2012-03-17 16:16 -0700
Message-ID<aaeb1f13-3e7e-46d7-bf95-5ece850bf783@j11g2000yqj.googlegroups.com>
In reply to#12847
On Mar 17, 8:24 am, cezary.tomc...@gmail.com wrote:
> W dniu sobota, 17 marca 2012, 04:15:52 UTC+1 użytkownik Scott Sauyet napisał:
>
> > CT wrote:
> [...]
> >     //~ I just attach this to the global namespace here instead
> >     //~ of using the `global` variable to reference `this`.
>
> As for global variable with this object I just use now:
>
> (function(){ return this || (1,eval)('this') })()
>
> based on articlehttp://perfectionkills.com/unnecessarily-comprehensive-look-into-a-ra...

I'll have to look at that article, but I can't imagine why Kangax
would recommend such a line of code (even for "strict mode" ES5
scripts). And, on the Web, there's no reason to be writing strict ES5
at the moment (if ever). In fact, it could be harmful as a large
percentage of browsers in use will ignore the "strict" designation,
creating inconsistencies across agents where there were none. Haven't
we got enough problems without inventing new ones? :)

By the same token, HTML5 is mostly for show-offs as well. Other than
for sites that show movies, it's mostly useless (for now).

[toc] | [prev] | [next] | [standalone]


#12876

Fromcezary.tomczyk@gmail.com
Date2012-03-18 04:27 -0700
Message-ID<1976064.3688.1332070078466.JavaMail.geo-discussion-forums@ynmb12>
In reply to#12861
W dniu niedziela, 18 marca 2012, 00:16:47 UTC+1 użytkownik David Mark napisał:
> On Mar 17, 8:24 am, cezary.tomc...@gmail.com wrote:
> > W dniu sobota, 17 marca 2012, 04:15:52 UTC+1 użytkownik Scott Sauyet napisał:
> >
> > > CT wrote:
> > [...]
> > >     //~ I just attach this to the global namespace here instead
> > >     //~ of using the `global` variable to reference `this`.
> >
> > As for global variable with this object I just use now:
> >
> > (function(){ return this || (1,eval)('this') })()
> >
> > based on articlehttp://perfectionkills.com/unnecessarily-comprehensive-look-into-a-ra...
> 
> I'll have to look at that article, but I can't imagine why Kangax
> would recommend such a line of code (even for "strict mode" ES5
> scripts). And, on the Web, there's no reason to be writing strict ES5
> at the moment (if ever). In fact, it could be harmful as a large
> percentage of browsers in use will ignore the "strict" designation,
> creating inconsistencies across agents where there were none. Haven't
> we got enough problems without inventing new ones? :)

Good, very well said. It seems that use "this" alone will be enough.

> By the same token, HTML5 is mostly for show-offs as well. Other than
> for sites that show movies, it's mostly useless (for now).

-- 
Regards,
CT

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.javascript


csiph-web