[Swift-devel] New syntax for appending to arrays
Yadu Nand
yadudoc1729 at gmail.com
Tue Jun 28 12:37:34 CDT 2011
Hi Mihael,
> There have been some schools of thought in language design that said
> that there should be one and only one way to do a certain thing.
I planned on implementing both methods, += operator as well as append()
so that once its done, it'd be easier to decide which is better.
Should I drop implementation for append() style ? I'm ok with that.
I'd like to point out one issue that came up between a discussion with
Justin today. I am using the earlier idea of the append being an assign
with the array subscript being the thread prefix.
Meaning array["key"] += 10 is [1]converted to array["key"]["!"] = 10 by
the parser.
There is still the possibility that the user may inadvertently use the string
"!" as subscript and create weird situations. So instead of "!" we could use
a string say "_SWIFT_AUTO_INCREMENT" . This being something used
internally.
[1] Well not converted exactly, but the kml generated is the same.
--
Thanks and Regards,
Yadu Nand B
More information about the Swift-devel
mailing list