PGia Posted 2 hours ago Posted 2 hours ago (edited) Hi again. There's something I can't seem to find a clear answer to. Maybe someone here can give me that answer. I'm experimenting with the use of dynamic variables, created in real-time. However, there's something that often makes me doubt whether it's advisable to use them. And that's where my question lies: If my code creates thousands of variables to avoid having to store data in a structure (lists or arrays)... when at the end of the code I cancel each of those variables with (set 'v nil), do the names of those variables really disappear from AutoCAD's symbol table, or only their content? I know about the atoms-family function and that it returns the value of a symbol if it exists. But the AI says that a negative response from atoms-family is not a guarantee that the symbol no longer exists in AutoCAD's internal symbol table. Thanks in advance. Edited 1 hour ago by PGia Quote
Lee Mac Posted 30 minutes ago Posted 30 minutes ago (edited) A couple of points to make: The need to create thousands of variables on-the-fly typically points to poor program design; in almost every case, a list is more suitable. Setting all such variables to nil at the end of the program does clear them from the document namespace, but consider that you are essentially creating & clearing global variables that are not local to the scope of your program, and as such, the variable names could potentially clash with identically named variables in the document namespace - this is generally considered bad practice. Edited 29 minutes ago by Lee Mac Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.