Chaiscript, anyone?

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
lefticus
Gnoblar
Posts: 5
Joined: Mon Oct 12, 2009 10:05 pm

Re: Chaiscript, anyone?

Post by lefticus »

Berserker wrote: 1) Why did you implement a custom api instead of the "common" boost one (boost::python or luabind)?
Great question. The short answer is, "because I didn't really look good enough at boost::python first." The long answer is that we really are doing something different than anyone else has. ChaiScript was developed specifically to work with C++, and it built around C++'s needs. At no point do we have to shoehorn C++ to fit into a preexisting language, like python or lua.

Looking closer at boost::python now, I see that would certainly could do many things like they are, and even discussed similar things early on, but it ended up being unnecessary because it was more verbose than ChaiScript needed.

It certainly would be possible to match the form of boost::python, if it would make a big difference in usability for some people.
Berserker wrote: 2) Are you going to support an "autowrapper"? I mean something like Py++. In my experience of embedding scripting engines (spydermonkey, python, lua ecc..), the most tedious part is when I have to expose my C/C++ library: at the moment I'm trying to automate this process using Py++ but with a lot of problems (mostly related to the CPython's GIL :twisted:, you can read some posts of mine in the Py++ mailing list) .

I'm always interested in looking at new scripting engines because I didn't found the "perfect" solution for me yet :lol:
We could easily write a sort of pre-processor for chaiscript that would dump some module code from a .hpp file, I would think. The goal of chaiscript was to make it straightforward enough that a preprocessor would be unnecessary, but I could see the utility in something that just helped you bootstrap the process.

IMO for anything less than 20 functions/types the bootstrapping would just get in the way, because you would then have to hand pick which methods you wanted to forbid the script from using. I'll add this idea to our bug tracker and see if we can follow up on it.
ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am
x 2

Re: Chaiscript, anyone?

Post by ppClarity »

How heavily tied to boost::thread are you? While I like boost for a lot of things, I've been seeing some compelling arguments for TBB.
lefticus
Gnoblar
Posts: 5
Joined: Mon Oct 12, 2009 10:05 pm

Re: Chaiscript, anyone?

Post by lefticus »

ppClarity wrote:How heavily tied to boost::thread are you? While I like boost for a lot of things, I've been seeing some compelling arguments for TBB.
We use boost::mutex for a few data structures and boost::thread_specific_ptr for stack management.

My gut says that what we use could possibly work within TBB, since the thread handling is all automatic. But maybe not? The crux of the question is whether or not boost::thread_specific_ptr would see two different TBB created threads as being different. If they use pthread underneath (or windows threads) then I would expect that it would work.

-Jason
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Chaiscript, anyone?

Post by nikki »

Question: What's the story behind the name? :P
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Re: Chaiscript, anyone?

Post by haffax »

Curious question. Tea is no more strange than moon or squirrel. ^^
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Chaiscript, anyone?

Post by jacmoe »

You assume that 'Chai' means spiced tea.
Which it does most of the time.

However, 'Chai' also means 'living' in Hebrew - and seeing that the Chaiscript guys are Christian coders, maybe it stands for 'Life' ? :)

Alternatively, it could also mean A wine shed, or other storage place above ground, used for storing casks, common in Bordeaux. :mrgreen:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Re: Chaiscript, anyone?

Post by haffax »

Oh, didn't knew about the hebrew meaning. But tea or life or moon or squirrel or falcon or whatever. Pick a word, any word, you've just invented a scripting language name... :lol:
team-pantheon programmer
creators of Rastullahs Lockenpracht
lefticus
Gnoblar
Posts: 5
Joined: Mon Oct 12, 2009 10:05 pm

Re: Chaiscript, anyone?

Post by lefticus »

jacmoe wrote:You assume that 'Chai' means spiced tea.
Which it does most of the time.

However, 'Chai' also means 'living' in Hebrew - and seeing that the Chaiscript guys are Christian coders, maybe it stands for 'Life' ? :)

Alternatively, it could also mean A wine shed, or other storage place above ground, used for storing casks, common in Bordeaux. :mrgreen:
The name is meant as a play on JavaScript, to kind of evoke the idea of being related to ECMA Script, but not to be as obtuse as Lua, Python or Ruby. So you see ChaiScript and you think, "oh, that must be a scripting language."

Not sure if it matters here or not, but just to make sure there's no misrepresentations, I am a Christian, but my partner on this project does not identify himself as such.
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Re: Chaiscript, anyone?

Post by nullsquared »

ChaiScript looks good but can I ask why in the world it's header-only? Compile times take longer with ChaiScript than even LuaBind, which was already slow enough.

Hm... what happens if you have an "unknown" value?

Code: Select all

var foo

// what's foo? how can I check if it's valid?
And what about NULL pointers?

Code: Select all

script.add(var(shared_ptr<int>()), "nullPtr");

// chai
// how to check if nullPtr points to anything?
Post Reply