Re: Assignment Operators

Kevin Edwards <[email protected]> Thu, 17 May 2012 01:19:56 -0500
Newsgroups gmane.comp.lang.io
Message-ID <[email protected]>
On 5/16/2012 4:16 PM, Jeremy Tregunna wrote:
> Radical, but I like our method of assignment in Acute (warning: 
> may contain dragons).
>
> Think of this psuedo-c code:
>
> (&foo).set(1);
>
> This above code would be seen as this: Get the address of some 
> fictitious "foo" variable, and then set its value to 1. "foo" need 
> not be in scope; if it's not, it would pick a location and return 
> that. This works best in cases where you expose the underlying 
> structure of your slot table in a meaningful way. You can make 
> that intermediary an object, and return that from the 'address of' 
> operator.
>
> We're going to take a similar approach in Acute, though details 
> aren't entirely fleshed out at the moment, so we're sticking with 
> having only one form of assignment until that is known; setSlot.
>
> The benefit of the above is also that assignment now takes only 
> one argument. This was the last of the "Io Calculus" core 
> primitives that we hadn't been able to factor out into a single 
> argument method.

So, Io's `target setSlot(name, value)` would become `target &name 
set(value)` where the `&` combines the target and the literal "name" 
into a Slot object with the usual get, set, delete, etc. methods.  
Is that right?  :-)

This idiom could almost be generalized for partial evaluation and 
keyword arguments.  Are you heading in that direction?

Kevin