Walter Bright, el 17 de enero a las 14:45 me escribiste: > dsimcha wrote: > >Furthermore, I think that less verbosity encourages good practices. I've > >gotten > >into the habit of declaring all my stack variables immutable when writing a > >function, unless I really need them to be mutable. This makes code a lot > >easier > >to understand because, when I look at the function later and try to figure > >out how > >it works, I know right off the bat that only a small subset of the variables > >are > >ever modified after they're declared. > > Andrei introduced me to that style, and I'm starting to use it more > and more. I like it for the reasons you state.
Do you remember when people asked for default immutability? I do :) To be fair, all I can find in the archives are about default immutability of function parameters, not local variables, but I'm under the impression that there was some discussion about making local variables immutable by default... I like the idea of making x := y an alias for immutable x = y (or even enum x = y). That would make this style much more attractive without breaking backward compatibility as immutable-by-default would do. -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- Hey you, dont help them to bury the light Don't give in without a fight.
