Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-18 Thread Leandro Lucarella
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. Thi

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-18 Thread Jason House
Leandro Lucarella Wrote: > 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

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-18 Thread Walter Bright
Leandro Lucarella wrote: Do you remember when people asked for default immutability? I do :) Yes, but it would break every other line of code already written in D. 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 attract

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-18 Thread dsimcha
== Quote from Walter Bright (newshou...@digitalmars.com)'s article > Leandro Lucarella wrote: > > Do you remember when people asked for default immutability? I do :) > Yes, but it would break every other line of code already written in D. > > I like the idea of making x := y an alias for immutable

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-18 Thread Steven Schveighoffer
On Mon, 18 Jan 2010 15:35:17 -0500, dsimcha wrote: == Quote from Walter Bright (newshou...@digitalmars.com)'s article Leandro Lucarella wrote: > Do you remember when people asked for default immutability? I do :) Yes, but it would break every other line of code already written in D. > I like t

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-18 Thread bearophile
Walter Bright: > Yes, but it would break every other line of code already written in D.< Is this a lot of D2 code? How much time does it need? Bye, bearophile

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-19 Thread Leandro Lucarella
bearophile, el 18 de enero a las 17:07 me escribiste: > Walter Bright: > > Yes, but it would break every other line of code already written in D.< > > Is this a lot of D2 code? How much time does it need? I think he includes D1 code, which would be harder to port to D2. Makes sense to me, that's

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-19 Thread Adam D. Ruppe
On Tue, Jan 19, 2010 at 11:52:16AM -0300, Leandro Lucarella wrote: > I think he includes D1 code, which would be harder to port to D2. Makes > sense to me, that's why I think introducing the := operator as an alias to > immutable/const would be a good compromise. It makes extremely easy to use > im

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-19 Thread Leandro Lucarella
Adam D. Ruppe, el 19 de enero a las 10:56 me escribiste: > On Tue, Jan 19, 2010 at 11:52:16AM -0300, Leandro Lucarella wrote: > > I think he includes D1 code, which would be harder to port to D2. Makes > > sense to me, that's why I think introducing the := operator as an alias to > > immutable/cons

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-19 Thread Adam D. Ruppe
On Tue, Jan 19, 2010 at 02:44:29PM -0300, Leandro Lucarella wrote: > I don't understand, you are vulnerable to that kind of bugs now too: > > const receiver = 1; > > const reciever = 2; // meant to rebind, but spelling error goes unnoticed by > compiler Right, but it is more of a conscious effo

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-19 Thread Pelle Månsson
On 01/19/2010 04:56 PM, Adam D. Ruppe wrote: On Tue, Jan 19, 2010 at 11:52:16AM -0300, Leandro Lucarella wrote: I think he includes D1 code, which would be harder to port to D2. Makes sense to me, that's why I think introducing the := operator as an alias to immutable/const would be a good compr

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-19 Thread Adam D. Ruppe
On Tue, Jan 19, 2010 at 10:51:11PM +0100, Pelle Månsson wrote: > Python, and most other dynamic languages, have that problem. They are > not suffering because of it. Meh, that's in the eye of the beholder. > Also, const cannot be rebound. Ah, so it can't. I figured they could, since strings can

Re: Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

2010-01-19 Thread Leandro Lucarella
Adam D. Ruppe, el 19 de enero a las 14:12 me escribiste: > On Tue, Jan 19, 2010 at 02:44:29PM -0300, Leandro Lucarella wrote: > > I don't understand, you are vulnerable to that kind of bugs now too: > > > > const receiver = 1; > > > > const reciever = 2; // meant to rebind, but spelling error goe