-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set unused variable to nil after .forget #53
Comments
@proppy klayout already sets the layer to Here is the link to klayout forget code: |
Then maybe we should submit a PR to klayout docstring https://github.com/KLayout/klayout/blob/c931a08ec08bb626b28d3009e015a0964936b012/src/drc/drc/built-in-macros/_drc_layer.rb#L253-L263 to stop advertising this as a best practice? /fyi @klayoutmatthias |
@proppy I think you might need to open that on Klayout. As I think |
That is easy to change :) ... my reasoning actually was that without setting the layer to nil, you will find the layer variable still holding a valid object which however is dead. Internally of course the expensive payload object is set to nil already. I thought that might be considered as a kind of violation of basic OO contracts. But it's a matter of taste. Ideally, setting the variable simply to nil would make the object forget, but Ruby is not like that because GC may be delayed. |
Thanks @klayoutmatthias @proppy I believe we can close this at our end. Isn't that correct? |
https://www.klayout.de/doc/about/drc_ref_layer.html#h2-1260 recommends the following pattern after
.forget
'ing a variable:we should make sure we follow it.
The text was updated successfully, but these errors were encountered: