These are chat archives for ChaiScript/ChaiScript

8th
Oct 2016
The Phantom Derpstorm
@ThePhD
Oct 08 2016 05:47
@lefticus I saw your CppCon talk, that stuff was amazing!
Daniel Guzman
@roig
Oct 08 2016 11:43
@lefticus Is it ok that chaiscript is internally throwing exceptions like: Exception thrown at 0x74F6C41F: Microsoft C++ exception: chaiscript::eval::detail::Return_Value at memory location 0x0052E2BC ?
Jason Turner
@lefticus
Oct 08 2016 13:28
@ThePhD Thanks!
@roig Yes. MSVC is very chatty about these things. It's a design flaw in ChaiScript specifically for return statements. I try hard to optimize around them. At some point I need to fix the design
def f(i)
{
  if (i == 2) { return 5; }

  /* else do a bunch of other stuff */
}

that return 5 statement is processed using an exception, intentionally to get the stack unwinding we want. If it's in performance critical code you might want to rearchitect your function so that the control flow doesn't rely on return

if you do something like:

def f(i)
{
  // blah blah blah

  return i + 2;
}

Where the return statement is the last thing in the function, I just remove that at script optimization time, since the last statement is the returned value anyhow.

Daniel Guzman
@roig
Oct 08 2016 13:37
Ok, I see.