3 ms·
"Please respond to the strongest plausible interpretation of what someone says, not a weaker one that's easier to criticize." [1] Embedding python in something
by gyulai 4y ago
"Please respond to the strongest plausible interpretation of what someone says, not a weaker one that's easier to criticize." [1]
Embedding python in something else was not part of my suggestion, rather I suggested using python in cases like scripting, where python would already be a good choice of an ecosystem. Also YAML-parsing was merely an example, and I wasn't necessarily envisioning that parsing a config file was the only actual purpose it would serve.
The fact is that no piece of code ever exists in a vacuum. It's always part of some application ecosystem, e.g. Windows GUI programming in C#, apache spark based ETL development in Java, scientific computation in Python, etc. ...most applications have an ecosystem (language+libraries) that's a clear "winner" in terms of adoption and richness of functionality for the given application.
My suggestion is merely this: Just go with the flow, pick the winning ecosystem, then embed lua and write your own stuff in lua while exposing whatever bits of ecosystem you need to integrate with to lua through some minimal logic that exists on the host language side.
If you context-switch at any point in the future, that gives you a good chance of being able to reuse your lua code. For example say you've developed some highly specialized piece of math for a scientific data crunching project in Python. Now you want to use that math in a GUI. Just embed lua in a host environment that's good for GUI development. ...chances are you'll be able to reuse that Lua code. If you had written the math library in Python to begin with, you're now in the difficult situation of being forced to use Python for GUI development, embedding Python in something that's good for GUI development, rewriting your code, all of which are pretty bad options and Lua might be a lesser evil.
[1] https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html