5 ms·
Of all the syntax options they could've gone with, they settled on what I would say is arguably the worst. If you want a one-liner, decorators are widely used a
by Etheryte 1y ago
Of all the syntax options they could've gone with, they settled on what I would say is arguably the worst. If you want a one-liner, decorators are widely used across different languages and Typescript supports them as well.
- javcasas 1y agoMy bad, this is open telemetry stuff to check the status of your servers, not for vendors to extract as much data as they can from you. > I'm trying to find how they implemented the "use workflow" thing, and before I could find it I already found https://github.com/vercel/workflow/blob/main/packages/core/src/telemetry.ts https://github.com/vercel/workflow/blob/main/packages/core/s... > Telemetry is part of the core. > Yuck.
- nakovet 1y agoIt's on the landing page, there is not even a standalone mode yet, so you can't use it with node.js you need to use with Next.js. All to say, it's just early alpha preview, I would wait the project to mature before considering using it anywhere.
- javcasas 1y agoMy bad, this is open telemetry stuff to check the status of your servers, not for the vendor to slurp as much data from you as possible.
- evilduck 1y agoThis is Open Telemetry functions you're referencing. Being able to trace, profile and debug your own code that's executing in a highly distributed environment is a pretty useful thing. This isn't (necessarily) user behavior telemetry. At least understand what you're looking at before getting the ick.
- javcasas 1y agoThat's fair. I'm too accustomed to seeing the other type of telemetry shoved in all over the place.
- skrebbel 1y agoGood luck running a server without any sort of telemetry. How will you debug stuff without logs and traces? Seems to me that the priorities are with practical, real everyday engineering concerns.
- oompydoompy74 1y agoIt’s apparently an swc compiler plugin.
- tom1337 1y agoYea but it's a vercel product and they also pushed the 'use server' and 'use client' directives and probably want to build on them.
- ajkjk 1y agoor no-op functions like useWorkflow() (with some kind of stub that prevents dead code elimination).
- MrJohz 1y agoDecorators don't work for functions, unfortunately, so wouldn't work in this case. You'd need to add a bunch of class boilerplate to make it work. JavaScript didn't have a lot of great options for this kind of statically-declared metaprogramming, which is why the "use X"; syntax has become so popular in various spaces. It's definitely not my favourite approach, but I don't think there's any clear "best" solution here.
- halflife 1y agoYou can use generator fns to achieve the exact same thing without magic strings or bundles. And the bonus is that you can debug it.
- MrJohz 1y agoI don't believe you can. I believe what they're trying to do is rewrite the underlying function into separate functions that can be called in any order and combination. That's not possible with generators. With a generator, I can pause between steps, but I can't, say, retry the third step four times until it succeeds, suspend the entire process, and then jump straight to the fourth step. Or I can't run different steps in different processes on different machines depending on load balancing concerns. I suspect that's why they need to transform the function into individual step functions, and for that they need to do static analysis. And if they're doing static analysis, then all the concerns detailed here and elsewhere apply and you're basically just picking your favourite of a bunch of syntaxes with different tradeoffs. I don't like magic strings, but at least they clearly indicate that magic is happening, which is useful for the developer reading the code.
- deleted 1y ago[deleted]