r/ProgrammingLanguages • • Apr 11 '23

Functional bytecode

I'm interested in whether work has been done to create a bytecode that is less imperative and more of a functional style. My hunch is such a bytecode may be more amenable to fast interpretation, since stuff like loops may be dispatched more directly to native code (instead of individual flow control ops). Has anyone seen anything like this? How annoying would it be for traditional languages to get translated into such a bytecode (does it require vectorization?)?

62 Upvotes

23 comments sorted by

View all comments

Show parent comment

1

u/pthierry Apr 12 '23

Bytecode is just binary data that's executed as is. Nothing prevents a VM to have instructions to create a nested context.

Also, if your VM is a stack machine, you basically get nesting for free.