Task 5: Support old API by using function evaluate
petervanhoef opened this issue · comments
We made the result
, description
and resultIsPending
vars non-private API in Assignment 1. That means we signed up to continue to support them even though we are now adding a new feature (variables) in this assignment which sort of makes them irrelevant. Really what we want to do is deprecate these (you’ll see all sorts of deprecated iOS API in Xcode), but for now we will keep the old result
, description
and resultIsPending
vars around and just implement each of them by calling evaluate
with the argument nil (i.e. they will give their answer assuming the value of any variables is zero). However, do not use any of these vars anywhere in your code in this assignment. Use evaluate
instead.
Old interface already uses 'evaluate' when implementing #1 and #2. See commit 60d3383.
Old interface can be deprecated: see The Swift Programming Language: Attributes
Hint 6 says: "Required Tasks 3, 4 and 5 are Model tasks ONLY. They have nothing to do with the UI (i.e. your Controller and its View). You shouldn’t change a single line of code in any file except the one containing your CalculatorBrain to implement these 3 tasks."
As we deprecated the old result
, description
and resultIsPending
vars and they are still used in the ViewController, we will get 3 compiler warnings (and a lot more in the unit tests).