Assignment/SETF macro

Brian Rice water at tunes.org
Sat Jan 28 15:11:45 PST 2006


That's correct. I'm still not sure about going forward with this,  
though, for the same reasons as before.

However, I am mostly occupied with other changes and problems, and  
this is much more a factor than hesitance or uncertainty.

On Jan 28, 2006, at 2:20 PM, Bill Sun wrote:

> Thumbs up :)
>
> This looks like it could also be applied to a previous
> discussion with regards to mutator methods being
> confused with verb message sends
> (http://thread.gmane.org/gmane.comp.lang.slate.general/863).
>  At least the message intent to the reader is clearly
> distinguished this way.  The mutator could then be
> changed to something that would avoid conflict with a
> possible verb message send of the same name. It could
> even be something obscure, but using `setTo will
> clearly express the intent of the code.
>
> Just some thoughts.
>
> -Bill
>
> --- Brian Rice <water at tunes.org> wrote:
>
>> I've added a macro `setTo: to macro.slate. See near
>> the end of:
>>
> http://slate.tunes.org/repos/main/src/lib/macro.slate
>>
>> Right now, all it does is expand some basic forms:
>>
>> (x atSlotNamed: #foo) `setTo: 4. => x atSlotNamed:
>> #foo put: 4.
>> (x at: 3) `setTo: 4. => x at: 3 put: 4.
>> (x at: 'key') `setTo: 4. => x at: 'key' put: 4.
>> x foo `setTo: 4. => x foo: 4.
>>
>> It is aliased as an empty keyword `: and binary `:=
>> as well.
>>
>> Benefits: The only benefit of it is to be able to
>> "identify"
>> assignment idioms more easily in code, but that
>> seems worthwhile. I
>> suppose it's possible to use it for code-generation
>> as well, to
>> abstract over assignment types, but I don't have a
>> use-case in that
>> direction yet - perhaps if I extended the C Syntax
>> types with the
>> same selector...
>>
>> Deficiencies: Type inference is not standardly used
>> in Slate yet, so
>> it can't infer whether or not something is an array
>> or dictionary or
>> even /has/ a (settable) #foo attribute as in the
>> last case. This
>> could happen in the future, though.
>>
>> Ideas, suggestions, complaints? Thumbs up or down?
>> Let me know. This
>> was an easy addition, really.
>>
>> NB: "SETF" refers to the "set field" macro in Common
>> Lisp, which
>> inspired this.

--
-Brian
http://tunes.org/~water/brice.vcf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /archives/slate/attachments/20060128/45dc0ad9/PGP.pgp


More information about the Slate mailing list