[Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Clément Bera
Hey guys, I was discussing about methods like that with Marcus: MyClass>>foo #(false) first ifFalse: [ 'first call since compilation' logCr. #(false) at: 1 put: true ] ifTrue: [ 'other calls' logCr ] DoIt: 4 timesRepeat: [MyClass new foo ] Transcript: 'first call since compilation' 'other calls

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Craig Latta
Hoi Clément-- In keeping with the principle of least surprise (and least time spent chasing strange bugs at 4am :), I would prefer that literals be immutable. thanks, -C -- Craig Latta netjam.org +31 6 2757 7177 (SMS ok) + 1 415 287 3547 (no SMS)

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Thierry Goubier
2014-10-27 16:22 GMT+01:00 Clément Bera : > Hey guys, > > I was discussing about methods like that with Marcus: > > MyClass>>foo > #(false) first > ifFalse: [ > 'first call since compilation' logCr. > #(false) at: 1 put: true ] > ifTrue: [ 'other calls' logCr ] > What, you can do that? > > DoIt

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Marcus Denker
I could imagine cases where, in very tight memory situations or with very very large literals, we could make use of modifying literals. But I'm not sure this is a significant requirement, or that it couldn't be considered if there is a significant (and rich) use case to fund the development of t

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Eliot Miranda
Hi Clément, IMO literals should be immutable all the time, and IMO the best way is via a per-object isImmutable bit. We implemented this for VW in 7.0 and it was a positive experience. I've implemented the "create an immutable subclass for each literal class" and it has lots of problems

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Eliot Miranda
On Oct 27, 2014, at 8:48 AM, Craig Latta wrote: > > Hoi Clément-- > > In keeping with the principle of least surprise (and least time > spent chasing strange bugs at 4am :), I would prefer that literals be > immutable. Sleep no sleep no sleep no sleep and no mad Video machine to eat tim

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Thierry Goubier
2014-10-27 17:03 GMT+01:00 Marcus Denker : > > > > > I could imagine cases where, in very tight memory situations or with very >> very large literals, we could make use of modifying literals. But I'm not >> sure this is a significant requirement, or that it couldn't be considered >> if there is a

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Levente Uzonyi
On Mon, 27 Oct 2014, Clément Bera wrote: Hey guys, I was discussing about methods like that with Marcus: MyClass>>foo #(false) first  ifFalse: [  'first call since compilation' logCr.  #(false) at: 1 put: true ] ifTrue: [ 'other calls' logCr ] DoIt: 4 timesRepeat: [MyClass new foo ] Transcrip

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Marcus Denker
> On 27 Oct 2014, at 17:16, Thierry Goubier wrote: > > > > 2014-10-27 17:03 GMT+01:00 Marcus Denker >: > > > > > I could imagine cases where, in very tight memory situations or with very > very large literals, we could make use of modifying literals. But I

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Tudor Girba
Talking about 4 am, you should also watch the coolest talk about it: http://www.ted.com/talks/rives_on_4_a_m And a beautiful follow up: http://www.ted.com/talks/rives_a_museum_of_4_o_clock_in_the_morning Cheers, Doru On Mon, Oct 27, 2014 at 5:13 PM, Eliot Miranda wrote: > > > > On Oct 27, 20

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread Craig Latta
Craig> In keeping with the principle of least surprise (and least time Craig> spent chasing strange bugs at 4am :), I would prefer that Craig> literals be immutable. Eliot> Sleep no sleep no sleep no sleep and no mad Eliot> Video machine to eat time, a city scene Eliot> I can't explain, strange b

Re: [Pharo-dev] Should literals be immutable ?

2014-10-27 Thread stepharo
I think that immutable literals is the way to go. Hey guys, I was discussing about methods like that with Marcus: MyClass>>foo #(false) first ifFalse: [ 'first call since compilation' logCr. #(false) at: 1 put: true ] ifTrue: [ 'other calls' logCr ] DoIt: 4 timesRepeat: [MyClass new foo ] Tr