Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: I don't get it Date: Wed, 14 Apr 2021 10:06:15 +0100 Organization: A noiseless patient Spider Lines: 49 Message-ID: <87im4pkzg8.fsf@bsb.me.uk> References: <586d1b88-77d5-42b0-ae5b-7506307df499n@googlegroups.com> <957a79db-946e-4f23-931a-ef7d4f0dbb3cn@googlegroups.com> <305fecc4-43da-4378-8430-ed10ac4dbe5bn@googlegroups.com> <20917gl3dv8shs6qqf1dqginq69e50aa54@4ax.com> <8735vytcwa.fsf@bsb.me.uk> <87lf9qrozz.fsf@bsb.me.uk> <875z0tq723.fsf@bsb.me.uk> <8b594439-379f-431f-8bf6-43c8066d3525n@googlegroups.com> <87o8ejpzv0.fsf@bsb.me.uk> <845c8b8e-d415-4b41-8327-6b31bc50825an@googlegroups.com> <1ae0aa1d-162d-4666-acf9-50376e1acd9fn@googlegroups.com> <8090782c-7564-4881-a97e-70dd1e865674n@googlegroups.com> <87y2dmmgln.fsf@bsb.me.uk> <875z0pn1sr.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="8c26916253c32cdde332367cf4f34a56"; logging-data="17258"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sYJPbeqa1kTHzqD4OKsBvu0BfEXj41MQ=" Cancel-Lock: sha1:pPV3mXDDeQ93+Dt9cgpwyp3uE7I= sha1:Rlho++usEFV/TCYOCgDCuV9+7+c= X-BSB-Auth: 1.c713aedd2bc0c1e8fb08.20210414100615BST.87im4pkzg8.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:39932 The Natural Philosopher writes: > On 14/04/2021 01:32, Ben Bacarisse wrote: >> The Natural Philosopher writes: >> >>> On 13/04/2021 14:58, Ben Bacarisse wrote: >>>> The function is doing exactly what you wrote. >>> >>> Not for at least two decades, and certainly not in JavaScript. >>> >>> The function is doing what the compiler and/or interpreter decided you >>> *meant* by what you wrote. >> >> It's a common mistake to think of code as implying more than it does. >> This is particularly true of high-level languages like ECMAScript, but >> it's also true of languages like C. Assuming more than the language >> guarantees has been the source of many bugs in C programs. >> >>> Which is why you now have new keywords like 'volatile' to try and >>> force it not to be clever with loop optimisations and Number() to >>> ensure it actually does cast an unknown variable type to a number... >> >> Hmm... Your recent Number() example seems to be simply a case of your >> not knowing what the language guarantees. > > Indeed. In the end that was exactly what it was, which proves that > particular point. The spec didn't cover the case. You are mistaken. Did you check the sections I cited? You seem to have a fixation with spreading FUD about the specification. > And yet it should have. I had no reason to suppose that having got it > working in Firefox it would utterly fail to work in IE4... I hope that 4 is a typo. The code you originally posted works as per the spec in IE6 (contrary to your previous claims). If is was broken in one, it had to be in Mozilla. Whilst I doubt that, I can't easily test old versions of it. You appear to be immune to these facts. The code you most recently posted shows nothing since if you want to compare two string numerically it makes sense to convert both explicitly to numbers. There's no relation to the previous point about implicit conversions as far as I can see since, given that you were unaware of what the language requires, you would not have converted only one. Anyway, you don't post the code that you say caused problems, only the "corrected" code which is exactly as I would expect it to look. -- Ben.