This is what I have suggested in my post. However in the meantime I think I have changed my mind and prefer the solution proposed in this thread:
- no
global
annotation needed, IJulia could drop the ‘automatically-insert-global-hack’ (hopefully I’m not wrong here, didn’t use IJulia in 1.0 yet). REPL doesn’t ‘need’ a similar ‘~hack’. - no (?) other language has such scoping rules in the for loop (is this true?)
- no surprises (1. there was a mention from a Matlab user at the breakfast table: you have to fix this – I think this is strong signal and bears weight, 2. there was a ‘bug report’ exactly about this problem – another signal of unexpectedness)
- advanced users are more fit to declare what they want, i.e. write
local
when needed (local for
is a cool idea, btw.) - copy/paste from REPL to functions works right away without ‘global adjustment’
- former hard/soft scope complication is still solved
The only price is that the for scope is now global ([Edit]: maybe this is really bad, I’m not sure). – This said, I don’t feel competent enough to really state an opinion…