[swift-evolution] Referencing zero-parameter functions

Alex Hoppen alex at ateamer.de
Thu May 5 10:59:51 CDT 2016


Say you have the function `foo() -> Int`. Then `foo()` calls `foo` and returns its return value of type `Int` – not a reference to the function of type `Void -> Int`. 

As to `_`: Like I stated in the proposal the underscore is already used in functions to state that there is no parameter name. So I think it’s a natural extension to also use it for saying that there are no arguments at all.

– Alex

> On 05 May 2016, at 17:21, David Sweeris <davesweeris at mac.com> wrote:
> 
> What’s wrong with `foo()` again? To me, a `_` in the parameter list means that something is there, but the label doesn’t matter.
> 
> - Dave Sweeris


More information about the swift-evolution mailing list