As a follow-up to proposal SE-0003: "Removing var from Function
Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function
parameters with the `let` keyword since function parameters are immutable
by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
P.S. Finally somebody wrote an email using non-black Comic Sans.
Pozdrawiam – Regards,
Adrian Kashivskyy
···
Wiadomość napisana przez Nicholas Maccharoli via swift-evolution <swift-evolution@swift.org> w dniu 17.03.2016, o godz. 09:27:
As a follow-up to proposal SE-0003: "Removing var from Function Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function parameters with the `let` keyword since function parameters are immutable by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
This makes perfect sense to me. Want to write up a proposal?
- Doug
···
On Mar 17, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution <swift-evolution@swift.org> wrote:
As a follow-up to proposal SE-0003: "Removing var from Function Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function parameters with the `let` keyword since function parameters are immutable by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
Since we’re allowing keywords as argument names, shouldn’t this:
func foo(let i: Int)
be allowed, such that it’ll be called as this:
foo(let: 3)
— Harlan
···
On Mar 17, 2016, at 11:08 AM, Douglas Gregor via swift-evolution <swift-evolution@swift.org> wrote:
On Mar 17, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
As a follow-up to proposal SE-0003: "Removing var from Function Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function parameters with the `let` keyword since function parameters are immutable by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
func foo(i: Int) { … }
This makes perfect sense to me. Want to write up a proposal?
Since we’re allowing keywords as argument names, shouldn’t this:
func foo(let i: Int)
Right now, you’d have to declare this as
func foo(`let` i: Int)
but the proposal would fix that.
be allowed, such that it’ll be called as this:
foo(let: 3)
Right.
- Doug
···
On Mar 17, 2016, at 11:22 AM, Harlan Haskins <harlan@harlanhaskins.com> wrote:
— Harlan
On Mar 17, 2016, at 11:08 AM, Douglas Gregor via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
On Mar 17, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
As a follow-up to proposal SE-0003: "Removing var from Function Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function parameters with the `let` keyword since function parameters are immutable by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
func foo(i: Int) { … }
This makes perfect sense to me. Want to write up a proposal?
The three reserved words are, if memory serves: let, var, and inout
var is gone. this would kill let. and `inout` is moved to modify types.
So by upending this part of the language we've managed to remove the special cases for argument labels. I view that as success.
- Doug
Agreed.
If Nicholas doesn't bite, I'm happy to throw this one into the "SadunProposalGeneratorType" instance.
I think I can write proposals now in my sleep and this is one that just seems to have an absolute beautiful
resonance with clarifying the language and letting the special cases disappear into the aether.
-- E
···
On Mar 17, 2016, at 12:58 PM, Douglas Gregor <dgregor@apple.com> wrote:
On Mar 17, 2016, at 11:49 AM, Erica Sadun <erica@ericasadun.com <mailto:erica@ericasadun.com>> wrote:
The intention was for this to be included as part of SE-0003. If it wasn’t, then that was an accidental omission. Do we really need a full proposal for that?
-Chris
···
On Mar 17, 2016, at 11:08 AM, Douglas Gregor via swift-evolution <swift-evolution@swift.org> wrote:
On Mar 17, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
As a follow-up to proposal SE-0003: "Removing var from Function Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function parameters with the `let` keyword since function parameters are immutable by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
func foo(i: Int) { … }
This makes perfect sense to me. Want to write up a proposal?
On Mar 17, 2016, at 11:08 AM, Douglas Gregor via swift-evolution < > swift-evolution@swift.org > <javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>> wrote:
On Mar 17, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution < > swift-evolution@swift.org > <javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>> wrote:
As a follow-up to proposal SE-0003: "Removing var from Function
Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function
parameters with the `let` keyword since function parameters are immutable
by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
func foo(i: Int) { … }
This makes perfect sense to me. Want to write up a proposal?
The intention was for this to be included as part of SE-0003. If it
wasn’t, then that was an accidental omission. Do we really need a full
proposal for that?
On Mar 17, 2016, at 11:08 AM, Douglas Gregor via swift-evolution <swift-evolution@swift.org <javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>> wrote:
On Mar 17, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution <swift-evolution@swift.org <javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>> wrote:
As a follow-up to proposal SE-0003: "Removing var from Function Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function parameters with the `let` keyword since function parameters are immutable by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
func foo(i: Int) { … }
This makes perfect sense to me. Want to write up a proposal?
The intention was for this to be included as part of SE-0003. If it wasn’t, then that was an accidental omission. Do we really need a full proposal for that?
On Mar 17, 2016, at 11:08 AM, Douglas Gregor via swift-evolution <swift-evolution@swift.org> wrote:
On Mar 17, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution <swift-evolution@swift.org> wrote:
As a follow-up to proposal SE-0003: "Removing var from Function Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function parameters with the `let` keyword since function parameters are immutable by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
func foo(i: Int) { … }
This makes perfect sense to me. Want to write up a proposal?
The intention was for this to be included as part of SE-0003. If it wasn’t, then that was an accidental omission. Do we really need a full proposal for that?
On Mar 17, 2016, at 11:08 AM, Douglas Gregor via swift-evolution < >> swift-evolution@swift.org> wrote:
On Mar 17, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution < >> swift-evolution@swift.org> wrote:
As a follow-up to proposal SE-0003: "Removing var from Function
Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function
parameters with the `let` keyword since function parameters are immutable
by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
func foo(i: Int) { … }
This makes perfect sense to me. Want to write up a proposal?
The intention was for this to be included as part of SE-0003. If it
wasn’t, then that was an accidental omission. Do we really need a full
proposal for that?
On Mar 17, 2016, at 11:08 AM, Douglas Gregor via swift-evolution <swift-evolution@swift.org <>> wrote:
On Mar 17, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution <swift-evolution@swift.org <>> wrote:
As a follow-up to proposal SE-0003: "Removing var from Function Parameters" being accepted,
I think it might make sense to disallow explicitly declaring function parameters with the `let` keyword since function parameters are immutable by default.
Basically disallow writing functions like this:
func foo(let i: Int) { ... }
and only allow the function above to be expressed as this:
func foo(i: Int) { … }
This makes perfect sense to me. Want to write up a proposal?
The intention was for this to be included as part of SE-0003. If it wasn’t, then that was an accidental omission. Do we really need a full proposal for that?
Because the proposals act as documentation for the evolution process, I think it may be worth
expanding the motivation section and the impact on existing code slightly.
You might also mention `let` in its current use is redundant since its inclusion does not and
cannot modify the behavior of the declaration it decorates. It is rarely if ever used and in the
circumstances when added produces no positive contribution to the language since the behavior
is identical to its absence.
In the Impact on Existing Code section, you suggest "The `let` keword would have to be deleted if
placed before a function parameter." I'd recommend mentioning the migrator specifically and
adding that if not migrated, the let will be be now be interpreted as an external label.
-- E, who probably thought about this one a little too hard
···
On Mar 17, 2016, at 10:45 PM, Nicholas Maccharoli via swift-evolution <swift-evolution@swift.org> wrote:
Because the proposals act as documentation for the evolution process, I
think it may be worth
expanding the motivation section and the impact on existing code slightly.
You might also mention `let` in its current use is redundant since its
inclusion does not and
cannot modify the behavior of the declaration it decorates. It is rarely
if ever used and in the
circumstances when added produces no positive contribution to the
language since the behavior
is identical to its absence.
In the Impact on Existing Code section, you suggest "The `let` keword
would have to be deleted if
placed before a function parameter." I'd recommend mentioning the migrator
specifically and
adding that if not migrated, the let will be be now be interpreted as an
external label.
-- E, who probably thought about this one a little too hard