Changing the spelling of @discardableResult or discard

The original SE-390 proposal called it “forget”. For the second review we renamed it to “discard”. I briefly searched both threads and didn’t spot any bike-shedding for the name. I don’t recall why we changed the name, either.

But, I think “forget” is rather vague as to what will happen to the value. It doesn’t suggest the value is destroyed at all.

I guess @discardableResult on a function f could be confused as meaning you can write discard f() to “discard” the returned value explicitly, but you can’t. In fact, you can’t use discard on anything other than self.

1 Like