[swift-evolution] Returning nothing

L. Mihalkovic laurent.mihalkovic at gmail.com
Fri Jul 22 01:07:09 CDT 2016



Regards
LM
(From mobile)

> On Jul 21, 2016, at 7:51 PM, Haravikk via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>>> On 21 Jul 2016, at 17:52, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
>>> On Jul 21, 2016, at 11:42 AM, Daniel Steinberg via swift-evolution <swift-evolution at swift.org> wrote:
>>> 
>>> This may be a silly question - given that one of Swift’s design principles is to be a language for new programmers and for APIs to read like English phrases, should we replace the typealias of Void for the return type () with Nothing.
>> 
>> Nothing was one of the names considered for the bottom type that replaces @noreturn (https://github.com/apple/swift-evolution/blob/master/proposals/0102-noreturn-bottom-type.md). I think it would be confusing to rename Void to Nothing.
> 
> I think on that issue the favourite for replacing @noreturn is Never or NoReturn, rather than Nothing (since @noreturn doesn't return nothing, it doesn't return in the first place), so Nothing is actually okay in that regard.


TS 2.0 adopted 'never'

> 
> I wouldn't mind the change of name, as void to me suggests something like a yawning abyss, which implies a substantive gap, rather than an actual absence of something, whereas Nothing is a bit clearer. That said I've never had any real trouble with Void, but can see Nothing being a tad easier to teach.
> 
> It's also not necessarily a very disruptive change, as many people don't write -> Void and just omit it, though personally I prefer to always write it out explicitly.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list