[swift-evolution] [Proposal] Change Void meaning

Xiaodi Wu xiaodi.wu at gmail.com
Mon Jun 12 13:06:20 CDT 2017


Nothing, Unit, and other names have been frequently suggested in the past,
but changing the name of Void was said to be out of scope even for Swift 3.


On Mon, Jun 12, 2017 at 13:02 Robert Bennett via swift-evolution <
swift-evolution at swift.org> wrote:

> The name Unit is used in Foundation for that exact meaning:
> https://developer.apple.com/documentation/foundation/unit.
>
> I like the name `Nothing` for the empty tuple. func foo(Nothing) {}
>
>
> On Jun 12, 2017, at 1:57 PM, David Sweeris via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>
> On Jun 12, 2017, at 10:44, Jérémie Girault via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> Void was the empty tuple because arguments were tuples. So no arguments
> meant empty tuple.
>
> If we consider the empty tuple to be an argument, then the type for the
> type of empty tuple should be `Unit`
>
> Void, however, seem naturally fitted for the absence of argument.
>
> Should `func foo(Void)` be different from `func foo()`? I don’t think so.
> But different from `func foo(Unit)` ? Yes !
>
> To me, "Unit" is used like "a unit of length", "a unit of time", etc. I've
> not come across it being used as analog for something like the empty tuple.
>
> - Dave Sweeris
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170612/fc555df3/attachment.html>


More information about the swift-evolution mailing list