[swift-evolution] Disallowing unreachable code

Brent Royal-Gordon brent at architechies.com
Wed Mar 29 18:21:41 CDT 2017


> On Mar 29, 2017, at 4:14 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>> On Mar 29, 2017, at 8:11 AM, John McCall via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> I was suggesting that it would be a useful addition to the language, not that it
>> necessarily needed new compiler support.
> 
> Personally, what I'd like to see is for the existing <#whatever#> placeholder syntax to be treated as an unimplemented() call. That probably *would* require compiler support, although fortunately we already parse this syntax into an EditorPlaceholderExpr.

Actually, looking more closely, we already have this behavior in playgrounds (and REPLs); it's only an error when you compile. Like, we literally do this:

      // Found it. Flag it as error (or warning, if in playground mode) for the
      // rest of the compiler pipeline and lex it as an identifier.
      if (LangOpts.Playground) {
        diagnose(TokStart, diag::lex_editor_placeholder_in_playground);
      } else {
        diagnose(TokStart, diag::lex_editor_placeholder);
      }

Could we change the compile-time error into a warning? Would that require an evolution proposal?

-- 
Brent Royal-Gordon
Architechies

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


More information about the swift-evolution mailing list