[ruby-core:105041] [Ruby master Misc#18125] A strange behavior when same name variable/method coexist issue.
From:
"zw963 (Wei Zheng)" <noreply@...>
Date:
2021-08-21 08:07:21 UTC
List:
ruby-core #105041
Issue #18125 has been reported by zw963 (Wei Zheng).
----------------------------------------
Misc #18125: A strange behavior when same name variable/method coexist issue.
https://bugs.ruby-lang.org/issues/18125
* Author: zw963 (Wei Zheng)
* Status: Open
* Priority: Normal
----------------------------------------
Following is a example.
## Reproduce
```rb
def deploy_to
"deploy_to"
end
deploy_to = "#{deploy_to} new place"
p defined? deploy_to # => local_varible
p deploy_to # => " new place"
```
## What we expected.
```rb
def deploy_to
"deploy_to"
end
deploy_to = "#{deploy_to} new place"
p defined? deploy_to # => local_varible
p deploy_to # => "deploy_to new place"
```
This strange behavior i found it after several years ruby programming.
Perhaps this is always the expected behavior?
i report here for check anyway
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>