| 05:09 | <Jack Works> | reviewing accessor in the decorator proposal |
| 05:10 | <Jack Works> | I have a question. In the @logged accessor x example, is it possible to use this.#x to access the derived private field to bypass the decorated accessor and access the original value? |
| 06:56 | <ljharb> | it should not be possible to access a private field inside the class body that was declared by the decorator |
| 06:56 | <ljharb> | iow, this.#x should only work if the class body declares #x, statically |
| 07:06 | <Jack Works> | Then what happened if I write: `#x; @logged accessor x = 1` |
| 09:45 | <nicolo-ribaudo> | The accessor uses a different private name; `#x` is a name chosen just to show that they are related in the example. |
| 10:32 | <Jack Works> | The accessor uses a different private name; `#x` is a name chosen just to show that they are related in the example. |
| 16:57 | <devsnek> | decorators on functions when 😠|
| 17:58 | <ljharb> | indeed, like symbols, each #x is a different one |
| 18:40 | <rbuckton> | decorators on functions when 😠|
| 18:42 | <rbuckton> | Function decls is trickier since decorating a function decl probably means that function isn't hoisted. |
| 19:34 | <devsnek> | imo that doesn't matter in practice but if we get function expressions that's good enough i suppose :( |
| 20:07 | <Ashley Claymore> | decorators on nested destructures bindings could be handy |
| 20:43 | <rbuckton> | imo that doesn't matter in practice but if we get function expressions that's good enough i suppose :( It would matter to the TS code base, at least (that is, if we wanted to decorate a function). Quite a bit of the code base is structured like this:
|
| 20:43 | <rbuckton> | decorators on nested destructures bindings could be handy |
| 20:44 | <devsnek> |
|
| 20:44 | <devsnek> | its opt in, that's the nice part |
| 20:44 | <devsnek> | anyway i don't wanna get into an argument about it, expressions sound "good enough" probably |
| 20:45 | <devsnek> | although you'd have to opt into expressions too |
| 20:49 | <rbuckton> | its opt in, that's the nice part |
| 20:50 | <devsnek> | sure but you need the same changes to use it with expressions 🤷 |
| 20:50 | <rbuckton> | That's probably a big enough reason we *wouldn't* use function decorators if they were available |
| 20:51 | <rbuckton> | sure but you need the same changes to use it with expressions 🤷 |
| 20:52 | <rbuckton> | My point is that, while breaking hoisting seems like a sensible choice on the surface, there's a lot more to the iceberg |
| 20:53 | <devsnek> | i don't see the difference, both turn the function into a tdz |
| 20:54 | <devsnek> | same iceberg |
| 21:35 | <Ashley Claymore> | For what purpose? I was thinking of a niche case, but will try and find a more mainstream use case for when this pattern:
Would benefit from this style: |
| 21:49 | <devsnek> |
const { @debounce(500) a } = y; |