right, wrong, better?

montgomery f. tidwell mtidwell at practicalmatters.com
Sun Aug 13 20:19:02 UTC 2000


Howdy,

in the FinancialHistory class (purple book) there are two
methods:

   totalReceivedFrom: source
      (incomes includeskey: source)
         ifTrue: [^incomes at: source]
         ifFalse: [^0]

   totalSpentFor: reason
      (expenditures includeskey: reason)
         ifTrue: [^expenditures at: reason]
         ifFalse: [^0]


given that they are basically the same, would it make sense to
change them to something like this?

   totalReceivedFrom: source
      ^totalOf: source in: incomes

   totalSpentFor: reason
      ^totalOf: reason in: expenditures

   totalOf: this :in that
      (that includeskey: this)
         ifTrue: [^that at: this]
         ifFalse: [^0]


                     \\//_





More information about the Squeak-dev mailing list