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


Groups > comp.lang.javascript > #19906 > unrolled thread

!0 versus true

Started byAndrew Poulos <ap_prog@hotmail.com>
First post2013-05-23 23:31 +1000
Last post2013-06-04 17:23 +0100
Articles 2 on this page of 42 — 10 participants

Back to article view | Back to comp.lang.javascript


Contents

  !0 versus true Andrew Poulos <ap_prog@hotmail.com> - 2013-05-23 23:31 +1000
    Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-23 07:58 -0700
    Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-23 17:53 +0200
      Re: !0 versus true Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-24 12:17 -0700
        Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-24 21:56 +0200
          Re: !0 versus true Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-24 13:13 -0700
            Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-24 22:23 +0200
        Re: !0 versus true Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:08 +0000
          Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-25 07:00 +0200
            Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-25 20:04 -0700
              Re: !0 versus true "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-05-26 11:07 +0200
              Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-26 13:11 +0200
                Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-26 13:28 -0700
                  Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-27 12:07 +0200
                    Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-27 11:27 -0700
                      Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-27 23:30 +0200
                        Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-27 17:12 -0700
                          Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-28 02:40 +0200
                            Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-27 20:29 -0700
                          Re: !0 versus true John Harris <niam@jghnorth.org.uk.invalid> - 2013-05-28 15:38 +0100
                            Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-28 08:32 -0700
                              Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-28 21:14 +0200
                                Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-28 15:38 -0700
                                  Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-29 13:20 +0200
                                    Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-29 06:37 -0700
                                      Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-29 16:28 +0200
                                        Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-29 13:32 -0700
                                          Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-29 23:34 +0200
                                            Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-30 06:30 -0700
                              Re: !0 versus true John Harris <niam@jghnorth.org.uk.invalid> - 2013-05-29 17:33 +0100
                                Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-29 11:34 -0700
                                  Re: !0 versus true John Harris <niam@jghnorth.org.uk.invalid> - 2013-05-31 10:22 +0100
                                    Re: !0 versus true Christoph Becker <cmbecker69@gmx.de> - 2013-05-31 13:04 +0200
                                      Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-31 18:13 +0200
                                        Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-31 18:16 +0200
                                    Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-05-31 07:25 -0700
    Re: !0 versus true imma harper <immaterial_uk@yahoo.co.uk> - 2013-05-31 09:46 -0700
      Re: !0 versus true Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-31 21:38 +0200
      Re: !0 versus true John Harris <niam@jghnorth.org.uk.invalid> - 2013-06-01 17:37 +0100
    Re: !0 versus true Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-06-02 21:03 +0100
      Re: !0 versus true Scott Sauyet <scott.sauyet@gmail.com> - 2013-06-03 04:45 -0700
        Re: !0 versus true Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-06-04 17:23 +0100

Page 3 of 3 — ← Prev page 1 2 [3]


#20122

FromScott Sauyet <scott.sauyet@gmail.com>
Date2013-06-03 04:45 -0700
Message-ID<de4181c7-fcd1-490f-87b7-21fcf3d042ce@m8g2000yqf.googlegroups.com>
In reply to#20119
Dr J R Stockton wrote:
> Andrew Poulos posted:
>> [ ... ]
>> One thing I found was that the minimiser had converted all instances of
>> true to !0.
>
>> When I reported it no one thought it an issue as both true and !0 are
>> truthy. Should they be concerned?
>
> That depends on the purpose of the minimisation.
> [ ... ]
>
> Where script is intended and expected to be executed very many times
> without ever being intended to be read as text, it is appropriate to do
> at least some programmed minimisation on the public-facing version -
> removal of leading and trailing white-space and blank lines, and of some
> or all comment, for example.

One note on the removing of comments, though.  A technique I've seen
in a number of places, and linked to again in the most recent
JavaScript Weekly [1], is the technique described at

    <http://tomasz.janczuk.org/2013/05/multi-line-strings-in-
javascript-and.html>

of creating multi-line strings in Javascript as the commented bodies
of functions.  The author was specifically talking about using this in
Node.js, and hence taking advantage of the known feature of V8.  The
example is this one:

    var html = (function () {/*
      <!DOCTYPE html>
      <html>
        <body>
          <h1>Hello, world!</h1>
        </body>
      </html>
    */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1];

Because several minifiers have a mechanism to exempt certain comments
from minification, this is at least feasible in certain browser-based
environments, even after minification.  But it fails in recent
SpiderMonkey versions and is certainly not to be recommended for the
browser.  Nonetheless, it's another interesting data point in the use
of function serialization.

  -- Scott
_____
[1] http://javascriptweekly.com/archive/132.html

[toc] | [prev] | [next] | [standalone]


#20149

FromDr J R Stockton <reply1300@merlyn.demon.co.uk.invalid>
Date2013-06-04 17:23 +0100
Message-ID<JTnU$$MAShrRFw35@invalid.uk.co.demon.merlyn.invalid>
In reply to#20122
In comp.lang.javascript message <de4181c7-fcd1-490f-87b7-21fcf3d042ce@m8
g2000yqf.googlegroups.com>, Mon, 3 Jun 2013 04:45:02, Scott Sauyet
<scott.sauyet@gmail.com> posted:

>Dr J R Stockton wrote:

>> Where script is intended and expected to be executed very many times
>> without ever being intended to be read as text, it is appropriate to do
>> at least some programmed minimisation on the public-facing version -
>> removal of leading and trailing white-space and blank lines, and of some
>> or all comment, for example.
>
>One note on the removing of comments, though.  A technique I've seen
>in a number of places, and linked to again in the most recent
>JavaScript Weekly [1], is the technique described at
> ...

I wrote "some or all comment" because
    (a) I could not immediately think of any non-removable comment,
    (b) [a few] cunning people like you exist.

A valuable response.

-- 
 (c) John Stockton, nr London, UK.   E-mail, see Home Page.    Turnpike v6.05.
 Website  <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
 PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
 Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | comp.lang.javascript


csiph-web