▲ | spankalee 3 days ago | ||||||||||||||||
I'm very excited by Porffor too, but a lot of what you've said here isn't correct. > - Porffor can use typescript types to significantly improve the compilation. It's in many ways more exciting as a TS compiler. Proffor could use types, but TypeScript's type system is very unsound and doing so could lead to serious bugs and security vulnerabilities. I haven't kept track of what Oliver's doing here lately, but I think the best and still safe thing you could do is compile an optimistic, optimized version of functions (and maybe basic blocks) based on the declared argument types, but you'd still need a type guard to fall back to the general version when the types aren't as expected. This isn't far from what a multi-tier JIT does, and the JIT has a lot more flexibility to generate functions for the actual observed types, not just the declared types. This can be a big help when the declared types are interfaces, but in an execution you only see specific concrete types. > or have a very simple arena allocator that works at the request level. This isn't viable. JS semantics mean that the request handling path can generate objects that are held from outside the request's arena. You can't free them or you'd get use-after-free problems. > - many of the restrictions that people associate with JS are due to VMs being designed to run untrusted code This is true to some extent, but most of the restrictions are baked into the language design. JS is a single-threaded non-shared memory language by design. The lack of threads has nothing to do with security. Other sandboxed languages, famously Java, have threads. Apple experimented with multithreaded JS and it hasn't moved forward not because of security but because it breaks JS semantics. Fork is possible in JS already, because it's a VM concept, not a language concept. Low-level memory access would completely break the memory model of JS and open up even trusted code to serious bugs and security vulnerabilities. > It is unlikely that many people would run something compiled with Porffor in a WASM runtime Running JS in WASM is actually the thing I'm most excited about from Porffor. There are a more and more WASM runtimes, and JS is handicapped there compared to Rust. Being able to intermix JS, Rust, and Go in a single portable, secure runtime is a killer feature. | |||||||||||||||||
▲ | samwillis 3 days ago | parent [-] | ||||||||||||||||
> I haven't kept track of what Oliver's doing here lately Please do go and check up what the state of using types to inform the compiler is (I'm not incorrect) On the area allocator, I wasn't clear enough, as stated elsewhere this was in relation to having something similar to isolates - each having a memory space that's cleaned up on exit. Python has almost identical semantics to JS, and has threads - there is nothing in the EMCAScript standard that would prevent them. | |||||||||||||||||
|