[swift-evolution] [Proposal draft] Make Optional Requirements Objective-C-only

Xiaodi Wu xiaodi.wu at gmail.com
Mon Apr 25 17:55:02 CDT 2016


On Mon, Apr 25, 2016 at 5:08 PM, Dave Abrahams via swift-evolution <
swift-evolution at swift.org> wrote:

>
> on Sun Apr 24 2016, Chris Lattner <swift-evolution at swift.org> wrote:
>
> >> On Apr 22, 2016, at 8:02 PM, Douglas Gregor via swift-evolution <
> swift-evolution at swift.org> wrote:
> >>
> >>
> >>
> >> Sent from my iPhone
> >
> >>
> >>> On Apr 22, 2016, at 5:56 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> >>>
> >>> Not an expert on Obj-C compatibility in Swift by any means, but this
> >>> reads like it's largely a change of nomenclature. To me, though,
> >>> `objcoptional` reads exceedingly poorly. Why not emphasize the Obj-C
> >>> compatibility angle by requiring the `@objc` attribute to precede each
> >>> use of `optional`? (In other words, effectively rename `optional` to
> >>> `@objc optional`.)
> >>
> >> That is a great idea.
> >
> > Doesn’t this have the same problem as the current (Swift 1/2)
> > implementation?  People will continue to believe that it is a bug that
> > you must specify @objc.
>
> Doesn't that argue for @objc(optional)
>
> ?
>

That was my first instinct as well, but I'm persuaded by Doug's points on
the issue, which I'll just quote below because he puts it much better than
I could:
* "It shouldn't be an attribute because it changes the type signature of
references to the requirement."
* "Do remember that @objc(something) already has a meaning: it gives the
Objective-C name “something” to the entity that the @objc(something)
describes."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160425/8012e574/attachment.html>


More information about the swift-evolution mailing list