Closed
Description
Consider the following code samples:
(1)
let mut positions = [Zero::zero (), ..ObjectAmount];
for uint::range (0, positions.len ()) |ii| {
positions[ii] = do objects[ii].position
}
(2)
let positions = do objects.map |object| { object.position }
Code example number (2) looks much prettier than code example (1) but is incorrect, as it returns a dynamically sized array. The code returns a dynamically sized array because the objects array is coerced to a dynamically sized array, and then the map method is called on the dynamic array. Can some method of making code sample number (2) happen be implemented? Right now, the behaviour is unintuitive, and annoying.
Metadata
Metadata
Assignees
Labels
No labels