> To me the appeal of annotating arguments as read-only (in) or write-only
> (out) is to catch subtle programmer errors.
I always had impression this was original purpose of such annotation is
languages such as C++. Optimization based on these came afterwards.
Even I have mixed feelings about Apple Swift, I think having functions argument
to be immutable by default and require to put "var" to make them mutable is
brilliant idea. I wish Julia had the same, e.g.
i = 1 # gives constant named "i"
var j = 2 # gives variable (mutable) named "j"
Forcing you to type extra "var" makes you really think what you are doing.
> But adding immutable wrappers for all the mutable types in the system and
> then adding the corresponding methods for both just strikes me as way too
> much duplication and complexity.
Are you talking about mutable containers or mutable references?
> Maybe we'll come up with a cleaner way to do it. Sometimes these things just
> need a good long time to think about and then voila! some bright idea emerges.
Please have a look at ideas behind Apple Swift, some of them are pretty neat.
Maybe Julia can borrow come of them.
Regards,
--Adam