Is Dictionary>>ifPresent: broken?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is Dictionary>>ifPresent: broken?

Alex Schenkman
Hi list:

Am I missing something or is this broken?

flag := false.
d := Dictionary new.
d at: #one put: 1.
d includesKey: #one. true 
d at: #one ifPresent: [ :value | flag:= true. value ]. nil
flag. false 

I've noticed the following:
at:ifAbsent: works fine, and it uses includesKey:
at:IfPresent uses basicAt:, and it does not work.

Thanks in advance!

Reply | Threaded
Open this post in threaded view
|

Re: Is Dictionary>>ifPresent: broken?

Nicolas Petton
Thanks Alex!

Could you add an issue on the bug tracker?

Cheers,
Nico

2012/5/9 Alex Schenkman <[hidden email]>
Hi list:

Am I missing something or is this broken?

flag := false.
d := Dictionary new.
d at: #one put: 1.
d includesKey: #one. true 
d at: #one ifPresent: [ :value | flag:= true. value ]. nil
flag. false 

I've noticed the following:
at:ifAbsent: works fine, and it uses includesKey:
at:IfPresent uses basicAt:, and it does not work.

Thanks in advance!


Reply | Threaded
Open this post in threaded view
|

Re: Is Dictionary>>ifPresent: broken?

Alex Schenkman
I've added the issue and sent a fix.

On Wednesday, May 9, 2012 4:29:37 PM UTC+2, nicolas petton wrote:
Thanks Alex!

Could you add an issue on the bug tracker?

Cheers,
Nico

2012/5/9 Alex Schenkman <>
Hi list:

Am I missing something or is this broken?

flag := false.
d := Dictionary new.
d at: #one put: 1.
d includesKey: #one. true 
d at: #one ifPresent: [ :value | flag:= true. value ]. nil
flag. false 

I've noticed the following:
at:ifAbsent: works fine, and it uses includesKey:
at:IfPresent uses basicAt:, and it does not work.

Thanks in advance!