"Super" hoisting

/#!/JoePea joe at trusktr.io
Fri May 13 18:02:58 UTC 2016


Maybe now that realtime graphically-intensive applications in the web
are becoming a thing, there needs to be some sort of standardization
on GC so that devs can make meaningful decisions on GC (rather than
guessing how to best optimize for different engines and often writing
ugly code because of it)? It just seems necessary...

On Fri, May 13, 2016 at 10:45 AM, Isiah Meadows <isiahmeadows at gmail.com> wrote:
> I think the original problem that caused this discussion with GC could be
> solved with just a weak map:
>
> ```
> // Original
> class thing {
>     doSomething(x, y) {
>         let a = x + y;
>         let b = ay;
>         let c = bx;
>         return (c);
>     }
> }
>
> // With a weak map
> const wm = new WeakMap()
>
> class thing {
>     doSomething(x, y) {
>         let data = wm.get(this)
>         if (data === undefined) {
>             wm.set(this, data = {
>                 a: x + y,
>                 b: ay,
>                 c: bx,
>             })
>         }
>         return data.c;
>     }
> }
> ```
>
>
> On Fri, May 13, 2016, 13:14 Brian Barnes <ggadwa at charter.net> wrote:
>>
>> On May 13, 2016, at 12:13 PM, /#!/JoePea <joe at trusktr.io> wrote:
>>
>> > Or "Cython in Javascript". I think your needs can be satisfied by C/C++
>> > addons in Node.js or WebAssembly in browser
>>
>> But we want to stay in JavaScript because we like the language. Plus,
>> writing a framework in JavaScript has the obvious advantage that a beginner
>> web programmer can just start using it easily (HTML/JAvaScript is like the
>> gateway drug of programming nowadays so there's certain advantages to
>> writing a library in JS as opposed to in C or compiling to WebAssembly).
>>
>>
>> I don’t think there being an alternate is any reason to not improve
>> something.  I’m realistic here, I know there are concerns which are
>> 1,000,000x more important than me, games or other time sensitive
>> applications, and backwards compatibility and language complications and
>> sometimes philosophy.  Just a few things here and there, though, not
>> necessarily any of the ideas I’ve come up with, can solve or mitigate this
>> problem.
>>
>> I never thought I’d see modules or classes!  Everything is on the right
>> path.  Just being able to deal with the GC (and maybe types if I’m lucky) is
>> the only big hurdle to the kind of thing myself and others are doing.
>>
>> [>] Brian
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list