3 ms·
(I work on Bun) A neat thing about tail calls in JavaScriptCore: there’s an explicit bytecode intrinsic for it. return @tailCallForwardArguments(MyConstruct
by Jarred 3y ago
(I work on Bun)
A neat thing about tail calls in JavaScriptCore: there’s an explicit bytecode intrinsic for it.
return @tailCallForwardArguments(MyConstructor, this);
To use this in Bun, you’d have to start Bun with the environment variable “BUN_JSC_useDollarVM=1” and then $vm.createBuiltin(mySourceCodeString)
When using this intrinsic, if any of the arguments are incorrect or it cannot otherwise enable it, the entire process will probably crash. In debug builds of JSC it will have a nicer assertion failure but that is not enabled in release builds
Example code: https://github.com/WebKit/WebKit/blob/17351231b4dedb62d8172112eaa0661e7b33260b/JSTests/stress/tailCallForwardArguments.js#L16 https://github.com/WebKit/WebKit/blob/17351231b4dedb62d81721...
also happy to answer any questions about Bun
- CodeGroyper 3y agoLove bun, thank you so much Mr. Sumner. What is the priority of app router integration for NextJS?
- johnfn 3y ago> What is the priority of app router integration for NextJS? I'm not Jarred, but what do you mean by this? I'm using bun + app router + NextJS and everything seems to work just fine.
- atmin 3y agoNot OP, but interested: can you deploy on a vps having only bun and not node?
- maxboone 3y agoYes
- reducesuffering 3y agoI don't think you're talking about what GP comment is. For clarification, Bun can act as a package manager like npm (probably the case of "bun + app router + NextJS" comment), and it can act as a replacement to a node runtime a la Express on a VPS (I'm assuming this is what you mean by "yes"). But Bun currently does not implement enough of the Node API's to use Bun as the runtime for a Next.js app. From Bun themselves: "The Next.js App Router currently relies on Node.js APIs that Bun does not yet implement. The guide below uses Bun to initialize a project and install dependencies, but it uses Node.js to run the dev server." https://bun.sh/guides/ecosystem/nextjs https://bun.sh/guides/ecosystem/nextjs
- deleted 3y ago[deleted]
- CodeGroyper 3y agoOn https://bun.sh/guides/nextjs https://bun.sh/guides/nextjs it says that bun currently does not implement the API to run the dev server.
- Jarred 3y agoAfter Windows support is further along, but not that long from now
- leptons 3y agoWhen do you see AWS Lambda supporting Bun, if ever?
- Jarred 3y agoYou can use it today with containers in Lambda or a custom Lambda runtime, but both approaches have embarrassingly slow cold start. Lambda has special optimizations for Node which are not possible without official support. I have no idea when Lambda would add an official runtime layer. But if you work at Lambda and are interested, feel free to email me - jarred@bun.sh