Ron: Very interesting, in particular, the function arguments by reference
aspect. Thanks.

Claude

-----Original Message-----
From: Ron Buckton <[email protected]> 
Sent: Monday, March 19, 2018 7:58 PM
To: Isiah Meadows <[email protected]>; Michael J. Ryan
<[email protected]>
Cc: es-discuss <[email protected]>
Subject: RE: Pointers

> -----Original Message-----
> From: es-discuss <[email protected]> On Behalf Of Isiah 
> Meadows
> Sent: Monday, March 19, 2018 3:21 PM
> To: Michael J. Ryan <[email protected]>
> Cc: es-discuss <[email protected]>
> Subject: Re: Pointers
> 
> And even if we *could* get pointers into JS, I'd *strongly* not want 
> it to be like what's proposed here. Instead, I'd prefer an object 
> encapsulating a reference to a variable, something like this (although 
> engines could avoid the ceremony of closures here):
> 
> ```js
> let foo = 1;
> 
> func(ref foo, bar)
> // Equivalent to:
> func({deref: () => foo, set: v => foo = v}, bar)
> 
> function func(ref foo, bar) {
>     foo += 2
> }
> 
> // Equivalent to:
> function func(foo) {
>     foo.set(foo.deref() + 2)
> }
> ```

I put together a strawman for this last year at
https://github.com/rbuckton/proposal-refs, but I haven't had much time to
work on it. 

Ron



---
This email has been checked for viruses by AVG.
http://www.avg.com

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to