What is your evaluation of the proposal?
+1, I’ve always wanted a #warning
directive in Swift.
Is the problem being addressed significant enough to warrant a change to Swift?
Yes. There are workarounds, but imo they’re cumbersome enough to make this feature important.
The workaround I’ve used is to define a global TODO
symbol that’s flagged as deprecated, so you can reference that symbol to produce a warning. However, this can only be used on lines where a standalone expression is supported, i.e. inside a function body, which is quite limiting. Also, the deprecation warning is semantically incorrect as mentioned above, and you can’t specify a message at the call site. #warning
doesn’t have any of these limitations.
The other workaround I know of is to use a build script to surface TODO comments as warnings, but it’s cumbersome to set this up in every project, and it feels like a hack. Having something standardized and built-in would be very helpful.
Does this proposal fit well with the feel and direction of Swift?
I think it does.
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
It’s basically the same as #warning
/ #error
in ObjC, which worked well imo.
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
Read the full proposal and skimmed the discussion.