These are chat archives for ChaiScript/ChaiScript

28th
Jun 2015
Jason Turner
@lefticus
Jun 28 2015 00:44

It's a reference counted object, so it will never be deleted as long as there still is a variable that points to it. I tried to closely model the C++ object lifetime. Let me see if I can better explain:

```

{
  var a = something();
  {
    var b = something();
  }
  // var b is popped from stack and destructed. If it is the last reference to the variable returned
  // from something, then the referenced variable is destroyed
}
// var a is popped from the stack and follows the same rules
There's actually a unit test that verifies this behavior: https://github.com/ChaiScript/ChaiScript/blob/develop/unittests/compiled_tests.cpp#L608-L654
mkalte
@mkalte666
Jun 28 2015 07:32
ah ok, now im shure where i make a mistake. Thanks again!
Jason Turner
@lefticus
Jun 28 2015 13:16
@mkalte666 I'm happy to review any public code you have posted, if you need any other help.
mkalte
@mkalte666
Jun 28 2015 17:40
Thanks! but at the moment im rebuilding my codebase and other things because i noticed that i made some serious mistakes... i dont have that much code that can be reviewed atm that wont change in the next weeks^^