Hacker News new | past | comments | ask | show | jobs | submit login

Nothing is unrepresentable, if I’m not mistaken.

https://en.m.wikipedia.org/wiki/Structured_program_theorem

Rather, I think the trade off was more in the realm of “aggressively optimize for what the web does well”.

With that being said, I do wish it was better suited for general purpose computation.




Irreducible loops (loops with more than one way to enter) are not representable by structured control flow. It's possible to model with with state variables (e.g. loop over switch). Incidentally if irreducible control flow is modeled this way (set the control variable to a constant and then branch back to the loop header which immediately then switches on the variable), and the compiler performs jump threading with constant propagation (i.e. duplicate the loop header up to the switch, and fold the switch), the resulting control graph will again have irreducible control flow. In fact it will be the same as the original control flow graph. So it's possible to undo the inefficiency of the state variable with some transformations in the Wasm consumer.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: