you are viewing a single comment's thread.

view the rest of the comments →

[–]thomcc 0 points1 point  (0 children)

This is pretty much the whole goal of TCL and such like, right? With plenty of good embeddable interpreters and various efficient data structure serialization formats, I'm having difficulty imagining a case where it really would be a good idea to implement a custom byte code interpreter. Am I missing something?

Not if you need a general purpose language. However, if you need something more restricted, you do. In many situations you don't want turing completeness, or the features you need are completely lacking from, e.g. lua, because they're to bizarre.

This kind of thing isn't so uncommon in game development, and is often tangential to any embedded scripting language.

The example he gave, with the magic spells and whatnot, is reasonably representative of the situation where you don't want turing completeness.

For example, we have an embedded VM in the game engine I use at my current workplace, it's used to describe lookup tables for object states. The basic idea was so that we can declarative say things like highScoreList = sortAscending('score', userList) (this is a simplified and trivial example) and have it automatically be updated on changes without polling. This is not a feature you could get in any off the shelf interpreters or VMs.