Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006364 [Squeak] Collections minor always 03-21-07 18:23 04-18-10 21:59
Reporter bfowlow View Status public  
Assigned To nicolas cellier
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version trunk Product Version 3.8
  Product Build
Summary 0006364: Collections ifEmpty: returns nil on non-empty
Description Collection ifEmpty: [ foo ]
returns nil if the collection is not empty,
owing to the placement of the return in

        ifEmpty: aBlock
                "Evaluate the block if I'm empty"
                ^ self isEmpty ifTrue: aBlock


It would be (I think) more useful to say
        ifEmpty: aBlock
                self isEmpty ifTrue: [ ^ aBlock value ]

returning the original collection if non-empty,
... since this allows expressions such as

        foo := (collection allAfterLast:'@') ifEmpty: [collection].
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0013432 - 49 - 49 - 49 - 49 - 49 - 49)
nicolas cellier
12-12-09 18:28

resolved in trunk by Levente (Collections-ul.186)
 

- Issue History
Date Modified Username Field Change
03-21-07 18:23 bfowlow New Issue
12-12-09 18:28 nicolas cellier Status new => resolved
12-12-09 18:28 nicolas cellier Fixed in Version  => trunk
12-12-09 18:28 nicolas cellier Resolution open => fixed
12-12-09 18:28 nicolas cellier Assigned To  => nicolas cellier
12-12-09 18:28 nicolas cellier Note Added: 0013432
04-18-10 21:59 andreas Status resolved => closed


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
38 total queries executed.
32 unique queries executed.
Powered by Mantis Bugtracker