Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2018-04-16 Thread Isiah Meadows
Related relevant proposal/strawman/whatever: - https://github.com/isiahmeadows/private-data-proposal - https://github.com/tc39/proposal-class-fields/issues/94 - https://github.com/zenparsing/js-classes-1.1/issues/44 And in particular in the first linked issue, I did propose an `export { ... } to

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2018-04-16 Thread /#!/JoePea
I think it'd be nice if there was something also easier, based only on file names or directory structure. ```js // log-foo.js import Foo from './Foo' console.log(Foo) ``` ```js // Foo.js class Foo {} export Foo for './log-foo' // or with expressions, all files in this folder export Foo for './*'

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2018-04-15 Thread /#!/JoePea
Ah, interesting! That would be useful! */#!/*JoePea On Sun, Apr 15, 2018 at 11:58 AM, Mike Samuel wrote: > The box function defined in github.com/mikesamuel/tc39-module-keys > enables things like this. > > > On Sun, Apr 23, 2017 at 4:42 PM, /#!/JoePea wrote: > >> Is there a way to share some s

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2018-04-15 Thread Mike Samuel
The box function defined in github.com/mikesamuel/tc39-module-keys enables things like this. On Sun, Apr 23, 2017 at 4:42 PM, /#!/JoePea wrote: > Is there a way to share some secret value across a few modules, and > prevent other modules? f.e. prevent modules of an app dev who is importing > mo

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2018-04-15 Thread /#!/JoePea
> GATEWAY That's an interesting idea, Bradley, thanks! I originally wanted this for implementing "protected" class members (i.e. sharing a WeakMap across subclasses in different files), but I've since done this another way that is even better: https://github.com/trusktr/lowclass. With lowclass we

RE: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2017-04-24 Thread doodad-js Admin
my English is not accurate) From: Jordan Harband [mailto:ljh...@gmail.com] Sent: Sunday, April 23, 2017 7:03 PM To: /#!/JoePea Cc: es-discuss Subject: Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret? Nope. This is exactly why it seems that

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2017-04-24 Thread Bradley Meck
Ah yes, my bad. `var`! On Mon, Apr 24, 2017 at 3:43 PM, Allen Wirfs-Brock wrote: > > On Apr 24, 2017, at 12:34 PM, Bradley Meck wrote: > > To an extent, yes. You can use hoisting of function declarations and > circular dependencies to create a "gateway". During circular dependencies, > you have

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2017-04-24 Thread Allen Wirfs-Brock
> On Apr 24, 2017, at 12:34 PM, Bradley Meck wrote: > > To an extent, yes. You can use hoisting of function declarations and circular > dependencies to create a "gateway". During circular dependencies, you have a > time where function declarations are available but evaluation has not > occure

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2017-04-24 Thread Bradley Meck
To an extent, yes. You can use hoisting of function declarations and circular dependencies to create a "gateway". During circular dependencies, you have a time where function declarations are available but evaluation has not occured. During that time you can setup your private state. Then, immediat

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2017-04-23 Thread Jordan Harband
Nope. This is exactly why it seems that "protected" couldn't have any way to work that has "hard" enforcement. The only true privacy in JS is via closure (including WeakMaps), or via the upcoming "private fields" proposal, assuming it stays as "hard private". Anything shared is publicly accessible