These are chat archives for ChaiScript/ChaiScript

8th
Apr 2015
Victor Lopez
@VictorJL
Apr 08 2015 00:02
I was wondering if this is the proper way to return a value from use. https://gist.github.com/VictorJL/8bc598fb10a8f1a9f877
Victor Lopez
@VictorJL
Apr 08 2015 00:11
This is with a map, in case the file used was already used it returns the precomputed value with the same path. I'm not really sure if it was stored in the proper place https://gist.github.com/VictorJL/fccb656fa9c1002dcf5f
Jason Turner
@lefticus
Apr 08 2015 04:15
That looks about right, I'll take a look at it all more closely tomorrow morning @VictorJL
Jason Turner
@lefticus
Apr 08 2015 14:23
@VictorJL Your implementation of saving the last value from use would cause the return value to never be freed, which is probably not what the user would expect. I went with a different approach. I added a new function eval_file that always evaluates the file every time it's called and use which still evaluates it exactly once. Both return the result of the file being executed. See change set here: ChaiScript/ChaiScript@63684d0 and documentation here: https://github.com/ChaiScript/ChaiScript/blob/develop/cheatsheet.md#evaluation
@VictorJL your other two issues are because you've not provided a copy constructor or an assignment operator for those types to chaiscript. I need to make the error handling of those issues a little better