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


Groups > comp.lang.javascript > #30950

Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ?

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ?
Date 2016-07-20 15:08 +0200
Organization PointedEars Software (PES)
Message-ID <1703874.PYKUYFuaPT@PointedEars.de> (permalink)
References <nmmso1$uof$1@shakotay.alphanet.ch> <e66dc666-80eb-4a05-8650-4681e2cb7be4@googlegroups.com> <1961081.iZASKD2KPV@PointedEars.de> <941fff3e-5d05-4648-ba43-51e9ceb3ca7d@googlegroups.com>

Show all headers | View raw


Michael Haufe (TNO) wrote:

> […] Thomas 'PointedEars' Lahn wrote:
>> Michael Haufe (TNO) wrote:
>> > var resolve = function resolve(){...}
>> > 
>> > This form is redundant.
>> No, it is not.
> 
> Correct in semantic details, but by "redundant" in this case I was using
> the synonym: "useless".

AISB, it is useless if and only if the function is not referred to from 
within its body.

> I would also use the same word "redundant" if the code happened to be the
> following:
> 
> var foo = function bar(){ /* explicit example with no reference to bar */
> }

It is still not useless if the function modifies the variable value but a 
reference to itself has to be kept (self-modifying code).

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Une Bévue <unbewusst.sein@fai.invalid> - 2016-07-20 05:55 +0200
  Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Une Bévue <unbewusst.sein@fai.invalid> - 2016-07-20 08:20 +0200
  Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-07-19 23:25 -0700
    Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-20 12:15 +0200
      Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-07-20 05:15 -0700
        Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-20 15:08 +0200
          Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-07-20 09:23 -0700
          Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Une Bévue <unbewusst.sein@fai.invalid> - 2016-07-23 18:52 +0200
  Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-20 12:15 +0200
  Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Stanimir Stamenkov <s7an10@netscape.net> - 2016-07-28 08:31 +0300
    Re: difference between "var resolve = function resolve() {...}" and "var resolve = function () {...}" ? Une Bévue <unbewusst.sein@fai.invalid> - 2016-08-01 06:44 +0200

csiph-web