> Am 18.07.2017 um 00:58 schrieb Greg Parker via swift-users > <swift-users@swift.org>: > > >> On Jul 17, 2017, at 10:01 AM, Nevin Brackett-Rozinsky via swift-users >> <swift-users@swift.org> wrote: >> >> Could / should these types be ExpressibleByStringLiteral? > > They should not. We are deliberately discouraging the string literal of the > name. The string literal should be in only one place: the definition of the > name constant. Everything else should use the constant. The compiler can > provide autocompletion and typo detection of the constant. The string literal > doesn't get that.
The thing is, with Notification.Name, you have to use them at least twice. So everybody is creating a constant. And typos in the String that defines the constant don't matter. So this solves the problem. With NSNib however, the default case is to use the name only once. And I would say with NSImage it's probably the same. I don't think people have been defining constants for these when they are only used once. It makes the code unnecessarily longer and more complicated. And a typo in the String that defines the constant matter just as much as a typo in the String literal. So in the default case this doesn't solve a problem. Kind regards, Manfred _______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users