Re: Proposal: Boolean.parseBoolean

2017-03-21 Thread Jordan Harband
The good answer is that `Boolean(x)` is the same as `‼x` (which is a good thing) - and the string "false" is truthy, since the only falsy string value is the empty string. On Tue, Mar 21, 2017 at 1:08 PM, Dmitry Soshnikov < dmitry.soshni...@gmail.com> wrote: > On Tue, Mar 21, 2017 at 11:49 AM,

Re: Proposal: Boolean.parseBoolean

2017-03-21 Thread Dmitry Soshnikov
On Tue, Mar 21, 2017 at 11:49 AM, Michael J. Ryan wrote: > I slightly disagree... mainly in that as it stands, we have a fairly loose > type coercion system that allows almost anything to be coerced into a > boolean... in this case "parse" at least in my mind means that it

Re: Proposal: Boolean.parseBoolean

2017-03-21 Thread Michael J. Ryan
I slightly disagree... mainly in that as it stands, we have a fairly loose type coercion system that allows almost anything to be coerced into a boolean... in this case "parse" at least in my mind means that it should cover the most common use cases. I understand that Boolean("false") doesn't

Re: A WeakMap where values (not keys) are weak references?

2017-03-21 Thread Mark S. Miller
What you are asking for is sometimes called a "WeakValueMap". It is a very sensible abstraction and sometimes exactly what is needed. It is easy to build using Maps (or WeakMaps, depending) combined with < https://github.com/tc39/proposal-weakrefs>. The old wiki.ecmascript.org shows an

Re: A WeakMap where values (not keys) are weak references?

2017-03-21 Thread Boris Zbarsky
On 3/21/17 2:15 AM, /#!/JoePea wrote: I'd like to have something like a WeakMap where the keys can be primitives and the values are weakly-held Objects It might be worth searching the archives: this has been proposed multiple times and discussed at quite some length. If there isn't an

bugs.ecmascript.org has an expired certificate

2017-03-21 Thread Boris Zbarsky
"The certificate expired on May 25, 2016 at 8:00 AM. The current time is March 21, 2017 at 10:10 AM." is what my browser tells me. I know issue tracking has moved to github, but there are still links pointing into the bugs.ecmascript.org tracker in various places, and finding the

Re: A WeakMap where values (not keys) are weak references?

2017-03-21 Thread Denys Seguret
Having java-like weak references would indeed solve many problems and would let us build our own collections. On 21/03/2017 08:34, T.J. Crowder wrote: What are your use cases for it? Rather than tying it to being a `Map`, I'd prefer to see something like Java's [`WeakReference`][1]: You

Re: A WeakMap where values (not keys) are weak references?

2017-03-21 Thread T.J. Crowder
What are your use cases for it? Rather than tying it to being a `Map`, I'd prefer to see something like Java's [`WeakReference`][1]: You could store the `WeakReference`s in a `Map` if you wanted strongly-referenced keys with weakly-referenced values. -- T.J. Crowder [1]:

A WeakMap where values (not keys) are weak references?

2017-03-21 Thread /#!/JoePea
Hey all, I'd like to have something like a WeakMap where the keys can be primitives and the values are weakly-held Objects, so if there are no more references to any of the Object values that the entry gets removed from the map. For example, it might look like this: ``` { ["foo"] =>