Prev: CreateTextFile
Next: Precise printing from Javascript?
From: John G Harris on 24 Jul 2010 11:15 On Fri, 23 Jul 2010 at 17:14:15, in comp.lang.javascript, David Mark wrote: <snip> >The languages own instanceof operator makes a >comparison between a constructor and a constructed object. See how >confusing that can be? <snip> Now you're in danger of causing confusion. Whether the function was designed to be a constructor or not is irrelevant. Whether the function was the one that actually constructed the object is irrelevant. The only thing that matters is the value of the prototype property of the function. John -- John Harris
From: David Mark on 24 Jul 2010 16:06 On Jul 24, 11:15 am, John G Harris <j...(a)nospam.demon.co.uk> wrote: > On Fri, 23 Jul 2010 at 17:14:15, in comp.lang.javascript, David Mark > wrote: > > <snip>>The languages own instanceof operator makes a > >comparison between a constructor and a constructed object. See how > >confusing that can be? > > <snip> > > Now you're in danger of causing confusion. Whether the function was > designed to be a constructor or not is irrelevant. That was certainly not my intent. But I am sure you know what I meant. > Whether the function > was the one that actually constructed the object is irrelevant. Yes, which is highly confusing with regard to the instanceof operator. That's been my point from the start. > > The only thing that matters is the value of the prototype property of > the function. > Yes, as explained and demonstrated in my original answer.
From: John G Harris on 25 Jul 2010 14:51 On Sat, 24 Jul 2010 at 13:06:49, in comp.lang.javascript, David Mark wrote: >On Jul 24, 11:15�am, John G Harris <j...(a)nospam.demon.co.uk> wrote: >> On Fri, 23 Jul 2010 at 17:14:15, in comp.lang.javascript, David Mark >> wrote: >> >> � <snip>>The languages own instanceof operator makes a >> >comparison between a constructor and a constructed object. �See how >> >confusing that can be? >> >> � <snip> >> >> Now you're in danger of causing confusion. Whether the function was >> designed to be a constructor or not is irrelevant. > >That was certainly not my intent. But I am sure you know what I >meant. <snip> It's noticeable that the outline description of [[HasInstance]] (sec 8.6.2) in the ES3 standard has the same confusion, and that the rewording in the ES5 standard is a fudge that is no better. John -- John Harris
From: David Mark on 25 Jul 2010 15:14 On Jul 25, 2:51 pm, John G Harris <j...(a)nospam.demon.co.uk> wrote: > On Sat, 24 Jul 2010 at 13:06:49, in comp.lang.javascript, David Mark > wrote:>On Jul 24, 11:15 am, John G Harris <j...(a)nospam.demon.co.uk> wrote: > >> On Fri, 23 Jul 2010 at 17:14:15, in comp.lang.javascript, David Mark > >> wrote: > > >> <snip>>The languages own instanceof operator makes a > >> >comparison between a constructor and a constructed object. See how > >> >confusing that can be? > > >> <snip> > > >> Now you're in danger of causing confusion. Whether the function was > >> designed to be a constructor or not is irrelevant. > > >That was certainly not my intent. But I am sure you know what I > >meant. > > <snip> > > It's noticeable that the outline description of [[HasInstance]] (sec > 8.6.2) in the ES3 standard has the same confusion, and that the > rewording in the ES5 standard is a fudge that is no better. > Yes. The specs are an invaluable (and slightly flawed) resource, but will definitely confuse absolute beginners. That's why many opt for the comfortable sales pitch of jQuery or the like (then they can ostensibly skip the "hard" stuff and straight to the head of the class).
From: Garrett Smith on 6 Aug 2010 22:26
On 2010-07-23 11:10 PM, David Mark wrote: > On Jul 24, 1:52 am, Garrett Smith<dhtmlkitc...(a)gmail.com> wrote: >> On 2010-07-23 08:18 PM, David Mark wrote: >> >> >> >>> On Jul 23, 11:07 pm, Garrett Smith<dhtmlkitc...(a)gmail.com> wrote: >>>> On 2010-07-23 01:12 PM, Alan Gutierrez wrote: >> >>>>> John G Harris wrote: >>>>>> On Fri, 23 Jul 2010 at 11:53:30, in comp.lang.javascript, Alan Gutierrez >>>>>> wrote: >> >>>> [snip informative explanation] >> >>>>> Thank you. Learn something new every day. >> >>>> Example: >> >>>> function Person(){} >>>> Person.prototype = {}; >>>> var a = new Person; >> >>> Use the call operator. Thanks. >> >> There isn't a call operator in ECMAScript. > > Oh brother. And, in your world, what do you call it? If you weren't a perpetual jerk or if you had at least asked a smart question non-insulting manner, I'd probably try and guess as to what I think you might have meant. But instead, you posted -- and it was pointed out -- your own made-up terminology to make a rather pointless comment. You followed that up with a loaded question[1] about "my world" (how ironic). And we just covered "my world" a day or two prior... Found it. You wrote: | In your own fantasy world I presume. In reality, your response | demonstrated a stunning lack of comprehension. And my reply: | I see you've snipped what was written and replied flippantly. It | reflects typical behavior of David Mark. And again, another typical DM reply. After a brief hiatus, I see the NG littered with more of the same from you. Ironically, you missed the actual problem in the code I posted. The problem is that my code omitted a semicolon. Two, actually. What is more ironic is that in the code guidelines document[2] goes to great length to explain the problem and in so doing, explains the lexical grammar production for what might likely be your "call operator" thing. The production is called `Arguments`. Then again, you've not explained yourself; so about the best I can do is guess as to what you wanted to ask. See also: [1] <http://catb.org/esr/faqs/smart-questions.html> [2] <http://jibbering.com/faq/notes/code-guidelines/> -- Garrett |