Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2414 closed defect (fixed)

[patch][cla] Reduce dojo.lang.reduce

Reported by: Adam Peller Owned by: alex
Priority: high Milestone:
Component: General Version: 0.4.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by alex)

The attached patch (and test) clears up several problems with dojo.lang.reduce:

  • the "lenght" typo
  • the fact that the arr.shift() is destructive on the argument passed in
  • removes bloat to check for an invalid call of arg length = 1
  • arg length 3 and the default case seem to be redundant
  • reorders the arg list to be more sane and reduce the code and api complexity (we can get away with it in 0.9)

I don't understand the history here so I'm assigning to Alex for review.

Thanks to Josh Staiger, IBM (CCLA)

Attachments (2)

reduce.patch (2.2 KB) - added by Adam Peller 12 years ago.
new code for dojo.lang.reduce
reduce-test.patch (778 bytes) - added by Adam Peller 12 years ago.
unit tests

Download all attachments as: .zip

Change History (10)

Changed 12 years ago by Adam Peller

Attachment: reduce.patch added

new code for dojo.lang.reduce

Changed 12 years ago by Adam Peller

Attachment: reduce-test.patch added

unit tests

comment:1 Changed 12 years ago by Adam Peller

Description: modified (diff)

comment:2 Changed 12 years ago by alex

Description: modified (diff)
Status: newassigned

Josh, Adam, great patch.

comment:3 Changed 12 years ago by alex

Milestone: 0.90.4.2

comment:4 Changed 12 years ago by Adam Peller

Alex -- just to point out that the patch implies an incompatible API change, recommended for 0.9. For 0.4.2, perhaps we could just fix the lenght typo? That's about as low risk as we can get :)

comment:5 Changed 12 years ago by alex

(In [7563]) refs #2414

applying the bits of Josh Staiger's patch that can be safely used in 0.4.x code. Will apply the full patch to trunk, but I'll be counting on Josh or Adam to fill in the porting guide for this function

comment:6 Changed 12 years ago by alex

(In [7564]) refs #2414

comment:7 Changed 12 years ago by alex

Resolution: fixed
Status: assignedclosed

(In [7565]) fixes #2414

comment:8 Changed 12 years ago by (none)

Milestone: 0.4.2

Milestone 0.4.2 deleted

Note: See TracTickets for help on using tickets.