Inconsistent description of "delete" in docs

Comments

2 comments

  • Miguel Gatsinzi

    I also initially thought that the delete function would remove the struct completely and possibly even variables within the struct, but like you said, the debugger shows that they are just undefined. So I'm in confusion to how this function should work and what to expect from it. It would be very handy to be able to remove the variables from within it, since you can add thm into it...

    0
    Comment actions Permalink
  • Ry Tan

    I thought it was completely clear. Using the delete keyword on a variable sets it to undefined, and if that variable was the last reference to the struct, then it marks it for the GC to delete. Semantically, it is a hint to the GC, and allows for more optimisation (setting to undefined does not have some of these semantics).

     

    -1
    Comment actions Permalink

Please sign in to leave a comment.