News for hackers. Stuff that matters.
Re:PayloadCMS: Open-Source, Fullstack Next.js Framework by vasergen on Monday October 14, 2024 @04:08PM (#41841381)
> React is a library

Can a library have compiler?)

Re:PayloadCMS: Open-Source, Fullstack Next.js Framework by robertlagrant on Monday October 14, 2024 @04:28PM (#41841594)
That's an optional step for JSX cross-compilation. It's a language plugin; nothing really to do with frameworks or libraries.
Re:PayloadCMS: Open-Source, Fullstack Next.js Framework by tmtwhn on Monday October 14, 2024 @07:39PM (#41843393)
They're going further than jsx transpilation[1]

[1] https://react.dev/learn/react-compiler

Re:PayloadCMS: Open-Source, Fullstack Next.js Framework by zdragnar on Tuesday October 15, 2024 @11:22AM (#41849546)
Nothing in that is actually doing what a compiler does above and beyond what babel, swc and esbuild are capable of.

What they've added is wrapping your code in more memoization functions, basically. All stuff that doesn't fundamentally transform the code, aside from inserting more `useMemo` and the like.

The JSX macro - which is itself already optional but everyone uses it - is just that, a handy macro with implementations available in every common bundler and transpiler out there.

Re:PayloadCMS: Open-Source, Fullstack Next.js Framework by gloosx on Tuesday October 15, 2024 @07:32AM (#41847417)
Javascript has a compiler called Babel, which plays a huge role in modern web development. It is in fact a transcompiler, meaning it doesn't turn your javascript into bytecode, it is just transpiling stuff without changing the level of abstraction.

React Compiler is just a babel plugin for automatic performance improvement, memoization specifically, for never perfectly memoized React code.

Can library have compiler? Well why can't it? For example stdlib has a compiler, because C does.