From: David Mark on
On Jan 4, 2:04 am, kangax <kan...(a)gmail.com> wrote:
> On 1/4/10 1:15 AM, David Mark wrote:
>
>
>
> > On Jan 4, 12:43 am, kangax<kan...(a)gmail.com>  wrote:
> >> On 1/3/10 8:43 PM, David Mark wrote:
>
> >>> On Jan 3, 8:34 pm, David Mark<dmark.cins...(a)gmail.com>    wrote:
> >>>> On Jan 3, 8:17 pm, Jorge<jo...(a)jorgechamorro.com>    wrote:
>
> >>>>> On Jan 4, 1:45 am, David Mark<dmark.cins...(a)gmail.com>    wrote:
>
> >>>>>> LOL.  So you should just screw all IE users and figure they will be
> >>>>>> grateful for the tough love?  Are you insane?
>
> >>>>> Don't know where you've been lately, but the days when you had to use
> >>>>> IE, yes or yes, are gone.
>
> >>>> Huh?  I don't know where _you_ have been lately, but many large
> >>>> corporations have endless seas of cubes stocked with IE users.  Some
> >>>> even have ActiveX and/or JS disabled _for them_ when using the public
> >>>> Internet.  Try that combo (both off) and notice that 90% of the Web
> >>>> falls apart (100% of jQuery-enhanced sites).
>
> >>> Correction.  I meant to say that 100% of jQuery-enhanced sites will
> >>> fail with ActiveX off (at least if they try to use Ajax).  With both
> >>> off, perhaps 50% (just a guess).  That is the only sort of
> >>> "progressive" enhancement that jQuery and the like allow for (on or
> >>> off).
>
> >> They won't _just fail_.
>
> >> Last time I checked IE would actually propose to disable scripts as soon
> >> as "automation server can't create object ..." error (the one that's
> >> thrown when initializing ActiveXObject with disabled ActiveX controls)
> >> happened.
>
> > Propose?  I've never seen it do anything but throw that obscure error
> > message at the user.  What version/configuration are you talking
> > about?
>
> IE7 shows error popup and asks if I want to continue running scripts on
> this page.

That may depend on the configuration. I know that some versions of IE
spew out the "automation server" message, which is going to scare the
hell out of most users.

>
> Something like this �
> <http://chadsanswers.com/wp-content/uploads/2009/04/toaster.jpg>, but
> different error of course.

Yep, that's a failure alright. ;)

>
> [...]
>
> >> But obviously there's really no reason to let errors like this happen. I
> >> think the problem is that not many developers are aware of a possibility
> >> for ActiveX to be disabled, and what to do about all this.
>
> > And that's very odd as it has been over a decade since IE6 came out
> > (and these issues were present IE<  6 as well).  Why should such
> > developers endeavor to shield neophytes from the rigors of cross-
> > browser scripting (translates to dealing with IE for most
> > applications) when they can't figure out IE.  They had a decade of
> > relative calm on that front and then...  ;)
>
> I've been meaning to write about it for some time now. Will do whenever
> I get a chance. Perhaps someone will listen.
>

Perhaps. :)
From: David Mark on
On Jan 4, 2:10 am, David Mark <dmark.cins...(a)gmail.com> wrote:
> On Jan 4, 2:04 am, kangax <kan...(a)gmail.com> wrote:
>
>
>
> > On 1/4/10 1:15 AM, David Mark wrote:
>
> > > On Jan 4, 12:43 am, kangax<kan...(a)gmail.com>  wrote:
> > >> On 1/3/10 8:43 PM, David Mark wrote:
>
> > >>> On Jan 3, 8:34 pm, David Mark<dmark.cins...(a)gmail.com>    wrote:
> > >>>> On Jan 3, 8:17 pm, Jorge<jo...(a)jorgechamorro.com>    wrote:
>
> > >>>>> On Jan 4, 1:45 am, David Mark<dmark.cins...(a)gmail.com>    wrote:
>
> > >>>>>> LOL.  So you should just screw all IE users and figure they will be
> > >>>>>> grateful for the tough love?  Are you insane?
>
> > >>>>> Don't know where you've been lately, but the days when you had to use
> > >>>>> IE, yes or yes, are gone.
>
> > >>>> Huh?  I don't know where _you_ have been lately, but many large
> > >>>> corporations have endless seas of cubes stocked with IE users.  Some
> > >>>> even have ActiveX and/or JS disabled _for them_ when using the public
> > >>>> Internet.  Try that combo (both off) and notice that 90% of the Web
> > >>>> falls apart (100% of jQuery-enhanced sites).
>
> > >>> Correction.  I meant to say that 100% of jQuery-enhanced sites will
> > >>> fail with ActiveX off (at least if they try to use Ajax).  With both
> > >>> off, perhaps 50% (just a guess).  That is the only sort of
> > >>> "progressive" enhancement that jQuery and the like allow for (on or
> > >>> off).
>
> > >> They won't _just fail_.
>
> > >> Last time I checked IE would actually propose to disable scripts as soon
> > >> as "automation server can't create object ..." error (the one that's
> > >> thrown when initializing ActiveXObject with disabled ActiveX controls)
> > >> happened.
>
> > > Propose?  I've never seen it do anything but throw that obscure error
> > > message at the user.  What version/configuration are you talking
> > > about?
>
> > IE7 shows error popup and asks if I want to continue running scripts on
> > this page.
>
> That may depend on the configuration.  I know that some versions of IE
> spew out the "automation server" message, which is going to scare the
> hell out of most users.
>
>
>
> > Something like this �
> > <http://chadsanswers.com/wp-content/uploads/2009/04/toaster.jpg>, but
> > different error of course.
>
> Yep, that's a failure alright.  ;)
>

And I think it bears pointing out that there is no recovery from such
an exception. It is highly unlikely that subsequent executions on the
page will be successful after such a flame-out.
From: Thomas 'PointedEars' Lahn on
kangax wrote:

> Thomas 'PointedEars' Lahn wrote:
>> kangax wrote:
>>> Thomas 'PointedEars' Lahn wrote:
>>>> Garrett Smith wrote:
>>>>> Thomas 'PointedEars' Lahn wrote:
>>>>>> Garrett Smith wrote:
>>>>>>> Ryan Chan wrote:
>>>>>>>> Function.prototype.method = function(name, func) {
>>>>>>>> this.prototype[name] = func;
>>>>>>>> return this;
>>>>>>>> };
>>>>>>>>
>>>>>>> This is not a good thing.
>>>>>>> The `method` method is not related to all Functions; only
>>>>>>> constructors.
>>>>>> Non sequitur. All Function instances may be used as constructor.
>>>>> No, none of the built in functions may be used as a constructor.
>>>> That is obviously wrong. RTFM.
>>> Wrong? Hardly. Incomplete, yes.
>>>
>>> A more correct rephrasing would probably be:
>>>
>>> None of the built-in functions may be used as a constructor, as none of
>>> them shall implement internal [[Construct]] method (unless specified
>>> explicitly in a corresponding section of specification).
>>
>> How can something be "more correct" (there is no comparison of
>> "correct") when it is still obviously wrong?
>
> You can't be serious...

I am dead serious.

> I'm sure you can find relevant section in specs on your own.

The question is: Can you? For the Specification is _not_ clear there, and
implementations vary.

ECMAScript Edition 5 states:

| 15 Standard Built-in ECMAScript Objects
|
| [...]
| None of the built-in functions described in this clause that are not
| constructors shall implement the [[Construct]] internal method unless
| otherwise specified in the description of a particular function. [...]

Mark the wording: "built-in functions that are not constructors". Now,
what *is* a "constructor"?

| 4.3.4
| constructor
| Function object that creates and initialises objects.

But the Specification defines that a "built-in function" is a "built-in
object that is a function." (ES5, 4.3.23), and that a "function (object)"
is a "member of the Object type that is an instance of the standard built-
in Function constructor and that may be invoked as a subroutine." (4.3.22)

There is *nothing* in the Specification that says that Function instances
are not [[Construct]]able by default. In fact, function instances/objects
do have by default an internal [[Construct]] property. (13.2)

But yes, I concur that section 15 casts doubt about whether built-in
methods should be used as constructor; to do that is probably error-prone.

However, in any case the statement "None of the built in functions may be
used as a constructor." is not only incomplete; it is obviously _wrong_.
As the statement is an existential negation, to prove it wrong I need only
one counter-example:

var o = new Object();


HTH

Pointed"new Array.prototype.join()"Ears
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
From: kangax on
On 1/4/10 2:15 AM, Thomas 'PointedEars' Lahn wrote:
> kangax wrote:
>
>> Thomas 'PointedEars' Lahn wrote:
>>> kangax wrote:
>>>> Thomas 'PointedEars' Lahn wrote:
>>>>> Garrett Smith wrote:
>>>>>> Thomas 'PointedEars' Lahn wrote:
>>>>>>> Garrett Smith wrote:
>>>>>>>> Ryan Chan wrote:
>>>>>>>>> Function.prototype.method = function(name, func) {
>>>>>>>>> this.prototype[name] = func;
>>>>>>>>> return this;
>>>>>>>>> };
>>>>>>>>>
>>>>>>>> This is not a good thing.
>>>>>>>> The `method` method is not related to all Functions; only
>>>>>>>> constructors.
>>>>>>> Non sequitur. All Function instances may be used as constructor.
>>>>>> No, none of the built in functions may be used as a constructor.
>>>>> That is obviously wrong. RTFM.
>>>> Wrong? Hardly. Incomplete, yes.
>>>>
>>>> A more correct rephrasing would probably be:
>>>>
>>>> None of the built-in functions may be used as a constructor, as none of
>>>> them shall implement internal [[Construct]] method (unless specified
>>>> explicitly in a corresponding section of specification).
>>>
>>> How can something be "more correct" (there is no comparison of
>>> "correct") when it is still obviously wrong?
>>
>> You can't be serious...
>
> I am dead serious.
>
>> I'm sure you can find relevant section in specs on your own.
>
> The question is: Can you? For the Specification is _not_ clear there, and
> implementations vary.
>
> ECMAScript Edition 5 states:

Ah, here we go. My fault for not specifying _which edition_ I'm talking
about. And yes, it was actually 3rd one I had in mind (and, I think, the
one Garrett referred to as well, since me and him already had
conversation over at es-discuss on the very same subject, back in
November �
<https://mail.mozilla.org/pipermail/es-discuss/2009-November/010162.html>).

>
> | 15 Standard Built-in ECMAScript Objects
> |
> | [...]
> | None of the built-in functions described in this clause that are not
> | constructors shall implement the [[Construct]] internal method unless
> | otherwise specified in the description of a particular function. [...]
>
> Mark the wording: "built-in functions that are not constructors". Now,
> what *is* a "constructor"?

This "...is not constructor..." addition clearly confuses matters here.

Compare to wording from 3rd edition:

"None of the built-in functions described in this section shall
implement the internal [[Construct]] method unless otherwise specified
in the description of a particular function."

>
> | 4.3.4
> | constructor
> | Function object that creates and initialises objects.

So, if built-in function doesn't create or initialize an object, it
shall not implement [[Construct]]. Isn't that what follows from:

1) None of the built-in functions described in this clause that are not
constructors shall implement the [[Construct]] internal method

2) construct is a Function object that creates and initialises (sic)
objects.

>
> But the Specification defines that a "built-in function" is a "built-in
> object that is a function." (ES5, 4.3.23), and that a "function (object)"
> is a "member of the Object type that is an instance of the standard built-
> in Function constructor and that may be invoked as a subroutine." (4.3.22)
>
> There is *nothing* in the Specification that says that Function instances
> are not [[Construct]]able by default. In fact, function instances/objects
> do have by default an internal [[Construct]] property. (13.2)

Aren't we talking about built-in functions? What do Function instances
have to do with this? Yes, Function instances have [[Construct]] but
built-in functions have their own "rules" and own preceding section
explaining exact semantics.

>
> But yes, I concur that section 15 casts doubt about whether built-in
> methods should be used as constructor; to do that is probably error-prone.
>
> However, in any case the statement "None of the built in functions may be
> used as a constructor." is not only incomplete; it is obviously _wrong_.
> As the statement is an existential negation, to prove it wrong I need only
> one counter-example:
>
> var o = new Object();

How is this a proof?

"...unless otherwise specified in the description of a particular
function" clause (from what you cited above) allows this.

[...]

--
kangax
From: Thomas 'PointedEars' Lahn on
kangax wrote:

> Thomas 'PointedEars' Lahn wrote:
>> kangax wrote:
>> There is *nothing* in the Specification that says that Function
>> instances are not [[Construct]]able by default. In fact, function
>> instances/objects do have by default an internal [[Construct]]
>> property. (13.2)
>
> Aren't we talking about built-in functions? What do Function instances
> have to do with this?

If you had cared to read the definitions I quoted ...

>> However, in any case the statement "None of the built in functions may
>> be used as a constructor." is not only incomplete; it is obviously
>> _wrong_. As the statement is an existential negation, to prove it
>> wrong I need only one counter-example:
>>
>> var o = new Object();
>
> How is this a proof?

`Object' is a built-in function.

> "...unless otherwise specified in the description of a particular
> function" clause (from what you cited above) allows this.

Irrelevant, that was not in the original (Garrett's) statement.
Apparently your logic module is borken after all.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>