Posted by
| Nick Gammon
Australia (23,043 posts) bio
Forum Administrator |
Message
| I'm still not sure what problem the more complex PPI module solves, that needs to be solved, other than as an academic exercise. You should take a look at the Lua forums one day, there are many posts there about adding obscure features to Lua to solve obscure problems, many of which the authors are resisting.
Just as an example, maybe a metatable to detect data changing in a table, rather than a missing index or adding a new index.
However, every enhancement comes at a cost, and in the case of this extra metatable entry, which you could probably argue would be useful, would add an overhead to *every* Lua program, including ones which don't require the feature.
Twisol, you argued in an earlier page in this thread that you wanted a more language-neutral solution (than the Lua serialized table) for passing parameters, but later on you talk about "not serializing metatables". Well of course, metatables are specific to Lua, so even if you attempted to do so, you would then have a Lua-specific solution again.
Even tables, self-referential or not, may not exist in every language. From memory, VBscript actually only has arrays, not tables indexed by arbitrary keys.
Thus a truly language-neutral API would keep to very simple arguments (eg. numbers, strings, booleans) and possibly simple single-level tables indexed by a numeric index.
Even with my method of passing parameters, if you had to set them up in a different language (like, Python) it wouldn't be hard to fudge up something that looked exactly right to match the serialize.save_simple output. OK, we need a number, a string, and a boolean. So it would be:
{
[1] = 42,
[2] = "nick",
[3] = true,
}
It would be easy for any language to produce something like that (basically you have the argument number in brackets, an "=" sign, and the data after it).
The type of data is implied. If it is quoted, it is a string. If it is a number, it is numeric. The words "true", "false", and "nil" have specific meanings. And if the value starts with a "{" then you have a sub-table which is easy to set up as well. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|