[swift-evolution] [Review] SE-0020 Swift Language Version Build Configuration

Dany St-Amant dsa.mls at icloud.com
Thu Jan 14 20:47:45 CST 2016

On the key statement of the proposal:

> Like other build configurations, #if swift isn't line-based - it encloses whole statements or declarations. However, unlike the others, the compiler won't parse inactive branches guarded by #if swift or emit lex diagnostics, so syntactic differences for other Swift versions can be in the same file.

I wonder if some structural check should be done nonetheless, like proper balancing of curly braces, and of comment marker (/**/). Neither of these can be overridden (afaik), and their pairing is unlikely to ever change.

The current #if syntax does prevent you from doing what I consider a bad habit that I have seen way too often in C.

#if os(Linux)
  if (boolCheck()) {
  if (optionalBoolCheck() ?? false) {
    /* Some code */

Main reason why  I hate these unbalanced curly brace, is that it messes up with simple tool like the % to jump to matching brace in vi.

Some may suggest that this fall in the coding style/lint bucket, but I have a feeling that such structural check coud help the parser.


> Le 12 janv. 2016 à 13:28, Douglas Gregor via swift-evolution <swift-evolution at swift.org> a écrit :
> Hello Swift community,
> The review of SE-0020 "Swift Language Version Build Configuration” begins now and runs through January 17th. The proposal is available here:
> 	https://github.com/apple/swift-evolution/blob/master/proposals/0020-if-swift-version.md <https://github.com/apple/swift-evolution/blob/master/proposals/0020-if-swift-version.md>
> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at
> 	https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> or, if you would like to keep your feedback private, directly to the review manager.
> What goes into a review?
> The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
> 	* What is your evaluation of the proposal?
> 	* Is the problem being addressed significant enough to warrant a change to Swift?
> 	* Does this proposal fit well with the feel and direction of Swift?
> 	* If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
> 	* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
> More information about the Swift evolution process is available at
> 	https://github.com/apple/swift-evolution/blob/master/process.md <https://github.com/apple/swift-evolution/blob/master/process.md>
> Thank you,
> Doug Gregor
> Review Manager
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160114/e0c7f08c/attachment.html>

More information about the swift-evolution mailing list