[swift-evolution] [swift-evolution-announce] [Review] SE-0044 Import as Member

Brent Royal-Gordon brent at architechies.com
Wed Mar 16 18:48:38 CDT 2016


> 	• What is your evaluation of the proposal?

Overall in favor.

I don't like the getter syntax:

	float Point3DGetRadius(Point3D point) __attribute__((swift_name("getter:Point3D.radius(self:)")));

I think we would be better off thinking of this instead as adding an accessor to a property, perhaps with a syntax along these lines:

	float Point3DGetRadius(Point3D point) __attribute__((swift_name("Point3D.radius.get(self:)")));

However, talking about operations-associated-with-a-property seems to be a common theme with the behaviors proposal; you may want to think about a syntax that could be used for both of them (and perhaps in demangling and diagnostics as well).

I also find it odd that this proposal doesn't address subscripts.

I assume that, on types imported as value types, Swift treats operations whose self parameter is a (non-const) pointer to the type as mutating and others as nonmutating. (This is not explicitly stated in the proposal, though.) However, it's not clear how Swift makes that initial determination of whether a type should be imported as a value type or a reference type.

Has this proposal's use against libdispatch been evaluated? I would love to see `dispatch_async(_:_:)` become `dispatch_queue.async(function:)`.

> 	• Is the problem being addressed significant enough to warrant a change to Swift?

Yes. Directly imported C APIs are a mess, and simple adapters are a pain to write. This substantially improves the situation.

> 	• Does this proposal fit well with the feel and direction of Swift?

Yes, it does. We seem to be pretty aggressively trying to improve bridging in this version, and this continues that theme.

> 	• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

I haven't; bridging is universally terrible.

> 	• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A couple reads at various points.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list