#18 Should not allow instVar and BlockClosure arg with same name

已关闭
nero8 年之前创建 · 0 条评论

Originally at 2011-08-26T18:21:07Z by Laurent Laffont closed at 2012-09-25T22:25:02Z

In JTalk I can write:

TestCase subclass: #CompilerTest
instanceVariableNames: 'dummy'
category: 'Kernel-Tests'


CompilerTest>>#testBlockVSInstVar
dummy := 3.

1 to: 1 do: [:dummy| self assert: 1 = dummy].

so dummy in the block equals 3 and not 1.

In Pharo it's not possible to have a block arg with same name as a instVar

Originally at 2011-08-26T18:21:07Z by Laurent Laffont closed at 2012-09-25T22:25:02Z In JTalk I can write: TestCase subclass: #CompilerTest instanceVariableNames: 'dummy' category: 'Kernel-Tests' CompilerTest>>#testBlockVSInstVar dummy := 3. 1 to: 1 do: [:dummy| self assert: 1 = dummy]. so dummy in the block equals 3 and not 1. In Pharo it's not possible to have a block arg with same name as a instVar
nero7 年之前 关闭
登录 并参与到对话中。
未选择标签
未选择里程碑
未指派成员
1 名参与者
正在加载...
取消
保存
这个人很懒,什么都没留下。