News for hackers. Stuff that matters.
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.
Re:21st Century C (new book) by davidw on Friday November 16, 2012 @11:50AM (#4794583)
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

Re:21st Century C (new book) by law on Friday November 16, 2012 @11:56AM (#4794612)
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.
Re:21st Century C (new book) by timknauf on Friday November 16, 2012 @01:05PM (#4794981)
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.
Re:21st Century C (new book) by mercurial on Friday November 16, 2012 @11:40AM (#4794530)
Which fight? As an embedded language, Lua is more popular, yes. Outside of this, probably not.
Re:21st Century C (new book) by cobrausn on Friday November 16, 2012 @11:42AM (#4794544)
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.
Re:21st Century C (new book) by duaneb on Friday November 16, 2012 @12:51PM (#4794905)
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.
Re:21st Century C (new book) by meaty on Friday November 16, 2012 @11:43AM (#4794550)
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.

Re:21st Century C (new book) by timknauf on Friday November 16, 2012 @01:13PM (#4795034)
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.