Re:21st Century C (new book)
by cobrausn on Friday November 16, 2012 @11:33AM
(#4794487)
I wonder why the author decided integrating with python was a better idea than, say, lua. Seems to me that lua is winning that fight, but that's just my current impression - I don't really have any solid numbers to back that up.
[ Parent
| on HN ]
Seems like something where you want to illustrate the concepts of integrating with a scripting language:
* Calling out from your C program to the scripting language.
* Setting variables in the scripting language from C.
* Creating functions that can be called from the scripting language.
* Making those available by creating a loadable shared lib that the scripting language can utilize.
Stuff like that is not that different across different languages and if you've figured one out, others won't be that hard.
My take: Tcl's C API is pretty cool. I wrote about it some here: http://www.amazon.com/dp/032133633X/?tag=dedasys-20
How mature is string manipulation in Lua? Personally, I use python for anything involving string manipulation, and then use C or C++ (depending on context) to do significant data processing on the (now hashed) data.
Lua's core string manipulation has been kept (as I understand it) deliberately limited in order to keep the implementation simple. What is present - e.g., simplified pattern-matching - is cleverly designed and often useful but, by design, there's nothing to compare to Python's rich built-in set of libraries.
Which fight? As an embedded language, Lua is more popular, yes. Outside of this, probably not.
That's what I was saying - if you wish to talk about integrating a scripting language with C in the 21st century, odds are it will be lua, not python.
Tell that to the scipy folks.
Re:21st Century C (new book)
by TazeTSchnitzel on Friday November 16, 2012 @11:39AM
(#4794525)
Lua also makes it very, very easy to integrate it with a C program.
Well in this case, it's more integrating Python with C i.e. writing a C callable and calling it from Python.
I'm not really a Lua fan personally (the confusing indice and ordinal notation scares me), but I can see why it makes sense for integration purposes. Clean, simple, to the point.
Having just completed a large project with Lua, I have to say that the indice/ordinal notation thing is something that we quickly got used to. In fact, some nice succinct idioms work because elements run from 1 to arraySize (inclusive).
Re:21st Century C (new book)
by sherjilozair on Friday November 16, 2012 @11:52AM
(#4794593)
Python usage is much more.