00:26 | <devsnek> | is there a transform for the current decorator proposal yet |
03:56 | <bakkot> | devsnek: https://javascriptdecorators.org/ exists, though I don't think it has perfect fidelity |
14:15 | <nicolo-ribaudo> | The Babel plugin will probably be released around the end of the year (we have a minor release every two months, and the transform is not ready yet for the next minor) |
15:00 | <devsnek> | honestly i don't think anyone would complain if decorating a function made it not hoist |
15:39 | <TabAtkins> | I would? Not hoisting is really annoying in non-trivial files, since it means the contents of your functions imposes an ordering on the functions themselves. |
15:40 | <TabAtkins> | It's why I almost never do the const fn = x=>...; thing that all the kids are doing these days. |
19:06 | <devsnek> | TabAtkins: a lot of people order stuff by use |
19:06 | <devsnek> | i think the two most popular eslint configs enforce that |
19:07 | <devsnek> | and it would only happen if you decorated something |
19:09 | <devsnek> | also how often do you need the pre-evaluate hoisting? even if stuff is out of order without the hosting it generally works at runtime cuz its after all the definitions are evaluated |
19:28 | <TabAtkins> | const/let impose a lexical tdz tho, so things preceding them that make reference to the binding can't find them, right? or do they capture a lexical ref and only complain if it's actually executed before hitting the variable def? |
19:28 | <TabAtkins> | it's been a while since i've run into issues, I just remember having problems at some point. |
19:29 | <devsnek> | TabAtkins: this code works
|
19:30 | <TabAtkins> | okay, i don't remember the issues i've run into in the past, then |
19:30 | <devsnek> | the case that breaks is if you call a() before const b = 2 |
19:30 | <devsnek> | which i think is |
19:30 | <devsnek> | exceedingly rare code |
19:31 | <TabAtkins> | i suspect it might have been something like starting a rAF() loop by calling the function immediatley after defining it, and then it blowing up because it depended on functions defined later in the file with const |
19:32 | <devsnek> | ah that sounds like smth that could happen |
19:32 | <devsnek> | but if you did update your raf code to use a decorator you could always adjust the call order :P |