[Accepted] SE-0039: Modernizing Playground Literals


(Chris Lattner) #1

Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0039-playgroundliterals.md

The review of SE-0039 "Modernizing Playground Literals" ran from Mar 7…9, 2016. The proposal has been *accepted* with modifications:

- The community and core team uniformly agree that this proposal increases uniformity in the swift language.
- We discussed how to rationalize naming and capitalization of identifiers in the “#” namespace and prefer to move to a model where it uses lower camel case.
- The argument label on imageLiteral should be “resourceName” to describe the role of the string and avoid needless words, following the naming guidelines from SE-0006.

As such, the preferred spelling of these literals are:

  #colorLiteral(red: 0, green: 0, blue: 0, alpha: 0)
  #imageLiteral(resourceName: “foo")
  #fileLiteral(resourceName: “bar”)

Implementing this would be a great starter task for someone interested in getting involved in the compiler. I filed SR-917 to track this effort. Thank you to Erica Sadun for driving this forward!

-Chris Lattner
Review Manager


(Chris Lattner) #2

Relatedly, the core team discussed changing #setline to follow camel case as well. As was brought up on another thread, the syntax for #setline is inconsistent with the other # directives because it doesn’t use parentheses. The core team discussed this a bit and recommends resyntaxing #setline to:

#sourceLocation(file: "foo", line: 42)

-Chris

···

On Mar 10, 2016, at 10:14 AM, Chris Lattner <clattner@apple.com> wrote:

Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0039-playgroundliterals.md

The review of SE-0039 "Modernizing Playground Literals" ran from Mar 7…9, 2016. The proposal has been *accepted* with modifications:

- The community and core team uniformly agree that this proposal increases uniformity in the swift language.
- We discussed how to rationalize naming and capitalization of identifiers in the “#” namespace and prefer to move to a model where it uses lower camel case.
- The argument label on imageLiteral should be “resourceName” to describe the role of the string and avoid needless words, following the naming guidelines from SE-0006.

As such, the preferred spelling of these literals are:

#colorLiteral(red: 0, green: 0, blue: 0, alpha: 0)
#imageLiteral(resourceName: “foo")
#fileLiteral(resourceName: “bar”)


(Step C) #3

I've been looking for a good spot to jump in, and this looks like a great opportunity. I'll follow up on SR-917.

···

On Mar 10, 2016, at 1:14 PM, Chris Lattner via swift-evolution <swift-evolution@swift.org> wrote:

Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0039-playgroundliterals.md

The review of SE-0039 "Modernizing Playground Literals" ran from Mar 7…9, 2016. The proposal has been *accepted* with modifications:

- The community and core team uniformly agree that this proposal increases uniformity in the swift language.
- We discussed how to rationalize naming and capitalization of identifiers in the “#” namespace and prefer to move to a model where it uses lower camel case.
- The argument label on imageLiteral should be “resourceName” to describe the role of the string and avoid needless words, following the naming guidelines from SE-0006.

As such, the preferred spelling of these literals are:

#colorLiteral(red: 0, green: 0, blue: 0, alpha: 0)
#imageLiteral(resourceName: “foo")
#fileLiteral(resourceName: “bar”)

Implementing this would be a great starter task for someone interested in getting involved in the compiler. I filed SR-917 to track this effort. Thank you to Erica Sadun for driving this forward!

-Chris Lattner
Review Manager
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Erica Sadun) #4

I'm submitting a separate update to the accepted setline proposal. It does not seem to fit into the 0039 write-up. The pull request for 0039 is
https://github.com/apple/swift-evolution/pull/206

I'm confused about setline. Will it be `setLine` or `sourceLocation`?

Accepted form and Modified design

Casing

After discussing how to rationalize naming and capitalization of identifiers in the “#” namespace, the core Swift team has adopted a lower camel case <https://en.wikipedia.org/wiki/CamelCase> model for identifiers.

The accepted form will use lower camel case either as #setLine or #sourceLocation.

Syntax

The syntax for #setLine/#sourceLocation is inconsistent with the other # directives in that it doesn’t use parentheses. After discussion, the core team will adjust the call to use parentheses and comma-separated colon-delimited argument and value pairs.

The final syntax will be either

#setLine(file: "foo", line: 42) // or
#sourceLocation(file: "foo", line: 42)

Please let me know and I'll modify and submit a PR

-- E

···

On Mar 10, 2016, at 11:17 AM, Chris Lattner via swift-evolution <swift-evolution@swift.org> wrote:

On Mar 10, 2016, at 10:14 AM, Chris Lattner <clattner@apple.com> wrote:

Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0039-playgroundliterals.md

The review of SE-0039 "Modernizing Playground Literals" ran from Mar 7…9, 2016. The proposal has been *accepted* with modifications:

- The community and core team uniformly agree that this proposal increases uniformity in the swift language.
- We discussed how to rationalize naming and capitalization of identifiers in the “#” namespace and prefer to move to a model where it uses lower camel case.
- The argument label on imageLiteral should be “resourceName” to describe the role of the string and avoid needless words, following the naming guidelines from SE-0006.

As such, the preferred spelling of these literals are:

#colorLiteral(red: 0, green: 0, blue: 0, alpha: 0)
#imageLiteral(resourceName: “foo")
#fileLiteral(resourceName: “bar”)

Relatedly, the core team discussed changing #setline to follow camel case as well. As was brought up on another thread, the syntax for #setline is inconsistent with the other # directives because it doesn’t use parentheses. The core team discussed this a bit and recommends resyntaxing #setline to:

#sourceLocation(file: "foo", line: 42)

-Chris
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution