On 4 March 2013 18:37, Colin Putney colin@wiresong.com wrote:
On Sun, Mar 3, 2013 at 7:12 PM, Igor Stasenko siguctua@gmail.com wrote:
yeah.. but i would go even further: since you already sending a message, why not using a looked-up name as selector? <obj> Foo -> gives binding of 'Foo' in environment. <obj> Foo: <value> -> sets the new value.
One of the goals with environments is to avoid syntactic or semantic changes to the language. All existing code should run as-is, and still benefit from the namespace isolation that we get from environments. Your idea above seems feasible for a new language, but it breaks compatibility.
breaks? how?
you mean changing compiler to compile "<obj> Foo" message send for accessing Foo name, instead of direct binding access?
yes, it changes semantics for global variable access.. but that's the way to go if you wanna introduce late-bound names.
but breaking compatibility... with what?
From language perspective, you can still be able compile & run smalltalk code
and perform it equally as canonical ST-80.. The way how compiler provides accessing to globals (or any method's external scope variables) is implementation detail. And you cannot introduce environments without changing that.. so i don't understand.
So I'll take this as a vote in favour of Eliot's idea—message send rather than direct access, but preserving the existing syntax and semantics of Smalltalk.
hmm.. you confused me.. in what way my proposal breaks any semantics/syntax? it uses message sends.. and no change to VM needed: you can create a behavior where all its method are accessors, so when you sending a message to an instance of such behavior you will get a variable value by its name.
Anyways.. i just gave an idea.. you're free to use it or throw it away , no problem :)
Thanks!
Colin