These are chat archives for ChaiScript/ChaiScript

26th
May 2015
patlecat
@patlecat
May 26 2015 08:29
@lefticus Hey, sorry for the long delay. As I mentioned I do have problems to get ChaiScript running properly and don't have a clue why it doesn't work anymore since the last version. I have a tried a lot of combinations, so the code may be a bit messy. But it's still very basic and should work as I understand it. My goal is to offer the users access to the filtered and extracted data as it is being processed so they can add, via ChaiScript, their own transformations to it. It's for this project, just to give you an idea what it is intended for: https://github.com/RedSilkSoftware/webtooth-extractor/
@lefticus Here's the code: http://pastebin.com/MYpH1iGz
patlecat
@patlecat
May 26 2015 08:39
I'm writing a separate script-writer for ChaiScripts that offers syntax-highlighting and a way to test the scripts for their integration into WebTooth.
Jason Turner
@lefticus
May 26 2015 15:04
Does anyone have experience in the world of emscripten? I'm looking to make a repl front end to chaiscript for people to try in the browser. Compiling with emscripten works and the result performs reasonably well - but the default interface for console applications is horrible
Jason Turner
@lefticus
May 26 2015 15:21

@patlecat So... you still haven't told me what the actual error you are getting is. And this isn't a full compilable example for me to test.

I see a couple of potential issues, however.

  1. You seem to be loading the chaiscript stdlib that I post on github. This is theoretically OK, but it's a release build, with optimizations, on every platform. C++ (not ChaiScript) is extremely sensitive to building templated code with the exact same settings for both the library and the executable. If things used to be working, but aren't now, that's the most likely problem. For testing, use the compiled-in stdlib http://chaiscript.com/examples.html#ChaiScript_Compiled_in_Stdlib_Example
  2. Your code where you execute the script seems to want to assume that the result is a string. (line 65 in that pastbin). ChaiScript is strongly typed, just like C++. It does not have any magical conversion from int to string, for example. You can call the built-in explict conversions to string, like the ChaiScript repl does: https://github.com/ChaiScript/ChaiScript/blob/develop/src/main.cpp#L233 See here we explicitly call to_stringvia ChaiScript, for each return value, because we know we want to display it to the user
  3. In your exception handler you are calling boxed_cast (line 107) which may itself throw an exception but you don't handle that in any way
  4. (The poorly documented issue) It is possible to register conversions with ChaiScript and there are a handful of built in ones (but not to_string, that's a function call and I believe I'm going to leave it that way). If you want these conversions to be called, then you should use the member function version of boxed_cast instead of the free function version. That is, chai.boxed_cast<std::string>(result); vs chaiscript::boxed_cast<std::string>(result).

I'm guessing it's very likely that issue #1 is your issue. If you are trying a Debug build or you are setting CHAISCRIPT_NO_THREADS or anything that's different from the official build, you will almost certainly have problems.

If that's not your issue, please tell me what error message you are getting. A stack trace would be nice. A fully standalone piece of code would be ideal.

If you make it a branch on your project I can even contribute to it directly with a fork. This is the best way that I can help you

patlecat
@patlecat
May 26 2015 15:40
Okay let me review your suggestions and create a rep on GitHub. Then I'll come back to you. Thanks a lot for your reply @lefticus.