Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #39900
| Path | csiph.com!news.mixmin.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: I don't get it |
| Date | Sun, 11 Apr 2021 14:33:56 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 101 |
| Message-ID | <875z0tq723.fsf@bsb.me.uk> (permalink) |
| References | <db867da0-d12e-4658-bbfc-f988789a42fan@googlegroups.com> <bb267a9e-7e6c-461a-8c97-a99a999fd154n@googlegroups.com> <d08a6beb-026a-4657-817e-b4ddcba5b73an@googlegroups.com> <1e965vkgenq7l$.hqmrkifgr4m5$.dlg@40tude.net> <586d1b88-77d5-42b0-ae5b-7506307df499n@googlegroups.com> <957a79db-946e-4f23-931a-ef7d4f0dbb3cn@googlegroups.com> <305fecc4-43da-4378-8430-ed10ac4dbe5bn@googlegroups.com> <s4p58i$g2u$1@dont-email.me> <20917gl3dv8shs6qqf1dqginq69e50aa54@4ax.com> <s4r30i$i9b$1@dont-email.me> <8735vytcwa.fsf@bsb.me.uk> <s4sn1v$5vl$1@dont-email.me> <87lf9qrozz.fsf@bsb.me.uk> <s4ujou$r1a$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | reader02.eternal-september.org; posting-host="0eb5575dba7d605a9a45ceaa8efe2197"; logging-data="20608"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+17mgWi9RVbXbM1PNOEKPBcTwfD0lB9Vw=" |
| Cancel-Lock | sha1:RfEIryjLoe5gdGcFUneBUgekl9M= sha1:3f98qKrPWN4BY/jlCQCGius/hho= |
| X-BSB-Auth | 1.2aee89c1eddfd309ca65.20210411143356BST.875z0tq723.fsf@bsb.me.uk |
| Xref | csiph.com comp.lang.javascript:39900 |
Show key headers only | View raw
The Natural Philosopher <tnp@invalid.invalid> writes:
> On 10/04/2021 19:08, Ben Bacarisse wrote:
>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>
>>> On 10/04/2021 15:47, Ben Bacarisse wrote:
>>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>>
>>>>> On 09/04/2021 20:01, John G Harris wrote:
>>>>>> On Fri, 9 Apr 2021 10:03:13 +0100, The Natural Philosopher
>>>>>> <tnp@invalid.invalid> wrote:
>>>>>>
>>>>>> <snip>
>>>>>>> After spending two days some years ago I discovered that IE and Firefox
>>>>>>> differed in their handling of comparisons of numerical and string data,
>>>>>>> and that something like
>>>>>>>
>>>>>>> if('1'== 1)
>>>>>>>
>>>>>>> was handled differently in each browser.
>>>>>>>
>>>>>>> As with all loosely typed languages, bugs in your code are trumped by
>>>>>>> bugs in the language itself.
>>>>>>
>>>>>> Was that before or after they claimed to conform to ECMA 262? If
>>>>>> after, one or both browsers had a bug, not the language. If before,
>>>>>> that's what you get with USPs.
>>>>>
>>>>> It was around 2007 give or take. IE6 and XP was current. I coded for
>>>>> firefox, it broke in IE6.
>>>>>
>>>>> I actually checked the language spec. As far as I cam remember the
>>>>> spec was explicit, that you converted to whatever the target of an
>>>>> assignement was in a mixed type operation, but in a conditional there
>>>>> was no assignment type...
>>>>
>>>> So you looked in the wrong place. I don't think that adds much useful
>>>> information. ECMA 262, 3rd edition (2000) is very clear about the
>>>> conversions required by the == operator (section 11.9.1 and 11.9.3).
>>>> For the record, the string should be converted to a number (and the
>>>> algorithm for doing that is given in great detail too).
>>>>
>>>> So it's not an issue with the specification. Testing in IE6 running on
>>>> XP I find that the conversion is done correctly. Did Mozilla really
>>>> have such a crude bug, and if so, did you really code for that despite
>>>> the specification being clear?
>>>>
>>> All I know is that IE6 and firefox gave different results and it was
>>> down to an implicit cast in a conditional statement. The code I have
>>> now - dated 2008, after fixing - simply turns everything explicitly
>>> into a Number()....so I assume that firefox was doing that implicitly
>>> and IE6 was not.
>>
>> I've tested it on IE6. Unless IE6 is a Heisenberg browser, it does the
>> conversion correctly.
>>
>>> You can defend the language all you like - I was past caring.
>>
>> I'm not defending the language.
>>
>>> I had a job to do and IE6 and firefox produced completely different
>>> results on the same web page, because of casting. Forcing everything
>>> to a number whether it needed it or not fixed the issue.
>>
>> Maybe is was Mozilla that got it wrong, or maybe you are
>> mis-remembering?
>>
> There was no right or wrong as I recall. Two browsers interpreted the
> spec differently because the correct interpretation was not clear.
I don't think you have read the specification. I can't see any room for
misinterpretation in this case. You made it clear that you had
originally read the wrong part of the specification so you can hardly
claim to be a reliable source for what the specification says.
> I coded for Mozilla. It worked, Others tried IE6, it didn't work. I
> scattered explicit Number() casts throughout my code, it worked for
> everyone.
Then you mislead people with your example, because IE6 does not get that
conversion wrong. I can't be sure that Mozilla did not (but I would be
very surprised) but IE6 is readily available for testing.
> At some level mozilla was casting to a number,
In the case you cited, that is correct (and very clearly required by the
specification).
> but IE6 wasn't.
I tested it on IE6 and it correctly converted the string to a number in
the comparison. I think you are spreading confusion.
> I spent a little time trying to work out what SHOULD happen, but the
> spec didn't cover the exact case.
That is not true. I gave you the section numbers that explain the
required conversions in an equality comparison (the case you cited).
--
Ben.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 03:32 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 03:37 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 04:26 -0700
Re: I don't get it JJ <jj4public@gmail.com> - 2021-04-08 19:39 +0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 05:53 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 13:55 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-09 00:46 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-09 10:03 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-09 04:09 -0700
Re: I don't get it "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-09 11:07 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-10 03:23 +0100
Re: I don't get it "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-10 22:02 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-11 01:05 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-11 01:07 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-11 11:42 +0100
Re: I don't get it John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-09 20:01 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-09 13:31 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-10 03:37 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-09 23:53 -0700
Re: I don't get it John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-10 12:05 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-10 15:59 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-10 15:47 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-10 18:25 +0100
Re: I don't get it Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-10 17:29 +0000
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-10 19:08 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-11 11:41 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-11 14:33 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-12 02:39 -0700
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-12 11:21 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-12 10:19 -0700
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-12 21:20 +0100
Re: I don't get it "sc...@sauyet.com" <scott@sauyet.com> - 2021-04-12 14:32 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-13 04:11 -0700
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-13 14:58 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-13 09:20 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-13 09:29 -0700
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-13 20:06 +0100
Re: I don't get it "sc...@sauyet.com" <scott@sauyet.com> - 2021-04-13 15:09 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-14 01:15 -0700
Re: I don't get it "sc...@sauyet.com" <scott@sauyet.com> - 2021-04-14 05:22 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-15 11:52 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-15 11:57 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-15 12:04 -0700
Re: I don't get it Scott Sauyet <scott.sauyet@gmail.com> - 2021-04-15 19:29 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-20 14:12 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-20 14:47 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-20 23:35 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-21 01:08 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-21 01:24 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-21 01:29 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-13 09:32 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-13 21:59 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-14 01:32 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-14 09:08 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-14 10:06 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-14 10:59 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-14 14:05 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-14 16:32 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-14 23:53 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-15 13:56 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-12 11:20 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-08 15:21 +0100
Re: I don't get it Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-09 16:50 +0200
Re: I don't get it Man From a city with name Viljandi <he12457@hotmail.com> - 2021-04-08 10:44 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-10 00:01 -0700
csiph-web