Tab Atkins Jr. wrote:
Using a primitive string as a key can
inadvertently leak the value for a long time, as the key might be
interned and long-lived, far past the point when your code has dropped
the intended references to it.
Indeed. Strings do not have observable reference semantics at
gt; }
>>>>> );
>>>>> ```
>>>>>
>>>>> Regards
>>>>>
>>>>> On Tue, Sep 8, 2015 at 9:57 PM, Michael McGlothlin <
>>>>> mike.mcgloth...@gmail.com> wrote:
>>>>>
>>>>>> I tr
On Thu, Sep 10, 2015 at 11:02 AM, Michael McGlothlin
wrote:
> One issue I did notice with WeakMaps is that because it can't use primative
> values as keys that they'll throw errors unless otherwise handled. Checking
> if they are an instanceof Object and if not using
s[Symbol.identity];
>>>>> }
>>>>> }
>>>>> );
>>>>> ```
>>>>>
>>>>> Regards
>>>>>
>>>>> On Tue, Sep 8, 2015 at 9:57 PM, Michael McGlothlin <
>>>>> mike.mcgloth..
>>>> have to define it manually.
>>>>>
>>>>> Symbol.identity = Symbol( 'Symbol.identity' );
>>>>> const identity = Symbol( 'identity' );
>>>>> var OBJECT_ID = 0;
>>>>> Object.defineProperty( Object.prototype, Symb
identity = Symbol( 'identity' );
>>>> var OBJECT_ID = 0;
>>>> Object.defineProperty( Object.prototype, Symbol.identity, {
>>>> get: () => {
>>>>if ( !Object.hasOwnProperty.call( this, identity ) ) {
>>>> this[ identity ] =
t;>> this[ identity ] = ++OBJECT_ID;
>>>}
>>>return this[ identity ];
>>> }
>>> } );
>>>
>>> On Tue, Sep 8, 2015 at 1:44 PM, Mark S. Miller <erig...@google.com>
>>> wrote:
>>>
>>>> See L
<joe...@gmail.com> wrote:
>>>
>>>> Didn't send to list, something is wrong with my reply all. Sorry about
>>>> that. Stupid mobile gmail.
>>>> -- Forwarded message --
>>>> From: "joe" <joe...@gmail.com>
&
0;
>>>> Object.defineProperty( Object.prototype, Symbol.identity, {
>>>> get: () => {
>>>>if ( !Object.hasOwnProperty.call( this, identity ) ) {
>>>> this[ identity ] = ++OBJECT_ID;
>>>>}
>>>>return this[ id
>> <mike.mcgloth...@gmail.com> wrote:
>>>>>> I try to keep it pretty simple. It's not fancy but the times you want
>>>>>> fast and dirty information like this are the same times you don't want
>>>>>> to have to define it manually.
>
For posterity:
http://wiki.ecmascript.org/doku.php?id=proposals:hashcodes
http://wiki.ecmascript.org/doku.php?id=discussion:hashcodes
(from ES4 daze, a long time ago.)
/be
Michael McGlothlin wrote:
Is there a reason not to provide an object id and hash value as other languages
often do? I
Michael McGlothlin wrote:
I'm only seeing a couple comments there - was that all or am I missing
something?
Did you read the note about security?
I think hashes as an overwritable method that returns a number is pretty
standard and let's you combine member hashes with simple Bitwise ops.
I'm only seeing a couple comments there - was that all or am I missing
something?
I think hashes as an overwritable method that returns a number is pretty
standard and let's you combine member hashes with simple Bitwise ops. Could
have on value types and a default on Object that would combine
rwarded message --
> From: "joe" <joe...@gmail.com>
> Date: Sep 8, 2015 11:15 AM
> Subject: Re: Object id, hash, etc?
> To: "Garrett Smith" <dhtmlkitc...@gmail.com>
> Cc:
>
> I agree with this request. This is the logical complement to valueof, I
>
On Tue, Sep 8, 2015 at 1:57 PM, Michael McGlothlin <
mike.mcgloth...@gmail.com> wrote:
> I try to keep it pretty simple. It's not fancy but the times you want fast
> and dirty information like this are the same times you don't want to have
> to define it manually.
>
> Symbol.identity = Symbol(
On Tue, Sep 8, 2015 at 2:07 PM, Mark S. Miller wrote:
> On Tue, Sep 8, 2015 at 1:57 PM, Michael McGlothlin
> wrote:
>>
>> I try to keep it pretty simple. It's not fancy but the times you want fast
>> and dirty information like this are the same
Hi Tab, then you get the Labeler, which this message is responding to.
On Tue, Sep 8, 2015 at 2:12 PM, Tab Atkins Jr. wrote:
> On Tue, Sep 8, 2015 at 2:07 PM, Mark S. Miller wrote:
> > On Tue, Sep 8, 2015 at 1:57 PM, Michael McGlothlin
> >
te:
>>
>>> Didn't send to list, something is wrong with my reply all. Sorry about
>>> that. Stupid mobile gmail.
>>> -- Forwarded message --
>>> From: "joe" <joe...@gmail.com>
>>> Date: Sep 8, 2015 11:15 AM
>>> Subject: Re: Obj
-- Forwarded message --
>> From: "joe" <joe...@gmail.com>
>> Date: Sep 8, 2015 11:15 AM
>> Subject: Re: Object id, hash, etc?
>> To: "Garrett Smith" <dhtmlkitc...@gmail.com>
>> Cc:
>>
>> I agree with this
Changing toString() is obviously not possible since the semantics are fixed and
many existing code depends them (ex. Object.prototype.toString are used for
type identifying, String.prototype.toString are used for meta-programming
frameworks. I think you can extend Object.prototype to provide a
Is there a reason not to provide an object id and hash value as other languages
often do? I find myself defining an identity symbol on objects with a value
from a simple global counter. It makes it easier to debug if I can just look at
a log and see what objects and functions were active.
Didn't send to list, something is wrong with my reply all. Sorry about
that. Stupid mobile gmail.
-- Forwarded message --
From: "joe" <joe...@gmail.com>
Date: Sep 8, 2015 11:15 AM
Subject: Re: Object id, hash, etc?
To: "Garrett Smith" <dhtmlki
22 matches
Mail list logo