3 ms·
A very interesting article. While the idea of using scripting to extend OS functionality has been around for a long time, surprisingly few attempts have been m
by jrapdx3 12y ago
A very interesting article. While the idea of using scripting to extend OS functionality has been around for a long time, surprisingly few attempts have been made to implement it.
Of the potential uses, an OS built-in webserver would be especially appealing. Many scripting languages provide tcp server/client APIs so it doesn't seem too much of a stretch to embed this functionality in a kernel. For example, Tcl's "socket" core command makes it very easy to set up a tcp server or client.
If performance or security is an issue, some interpreted languages can also be compiled to native code. There are Scheme implementations that are embeddable in C and can load interpreted or compiled modules.
One thing I didn't completely grasp is the distinction of "embedding" vs. "extending". Are these really disjoint ideas? I found this puzzling:
"... Extension scripts are loaded into instances of a kernel-embedded Tcl interpreter that execute in independent system processes [22]. A set of extension bindings exposes to the scripts the necessary resources for extending the kernel. What distinguishes our approach from [micro]Choices is our support of scripting by embedding the language interpreter, in addition to scripting by extending it." [emphasis is mine]
On the whole, the idea seems familiar and sensible where sane security policies and safety constraints are applied to actions of the embedded scripting language.
- alricb 12y agoRe: extending vs. embedding, it depends on whether your main app is written in Lua, with C bindings (extending), or in C, with the C code calling the Lua interpreter (embedding). See for instance this Python guide: https://docs.python.org/2/extending/ https://docs.python.org/2/extending/
- sdegutis 12y agoYes, there is a difference between embedding and extending. Extending means your app is just a module that lives in the language's interpreter. Embedding means the language interpreter lives in your app. One advocate[-1] of extending prefers it simply because he got bitten by his own poor design. Another advocate[undefined] prefers it simply because he prefers JavaScript and the easiest way to embed it is to write your app as C plugins that hook into V8[NaN]. The Python community[2] will unfailingly tell you to choose extending over embedding, delegating their reasoning to this highly questionable rant[2]. [-1]: https://julien.danjou.info/blog/2011/why-not-lua https://julien.danjou.info/blog/2011/why-not-lua [undefined]: Zhivago in ##c on freenode; please go say hi to him and make sure 2 use abbvs and dont use punctatng or spell thngs rite b4 him [NaN]: http://stackoverflow.com/questions/6334618/experience-embedding-javascript http://stackoverflow.com/questions/6334618/experience-embedd... [2]: aka #python on freenode [2]: http://twistedmatrix.com/users/glyph/rant/extendit.html http://twistedmatrix.com/users/glyph/rant/extendit.html
- sitkack 12y agoThe 'Python community' says those things because the CPython codebase is a PITA to embed, that is the only reason. With a clean design, like the Lua interpreter, embedding vs extending is about equal.
- mntmn 12y agoI'm working on something that goes in this direction but it will still take a lot of work: https://github.com/mntmn/home-lisp https://github.com/mntmn/home-lisp I think the "peripheral agnostic" idea might not work out, though.
- adamnemecek 12y ago> Of the potential uses, an OS built-in webserver would be especially appealing. Windows actually has something like that. It's called http.sys.