[swift-evolution] Reconsidering SE-0003 Removing var from Function Parameters and Pattern Matching

Tino Heth 2th at gmx.de
Thu Jan 28 06:40:53 CST 2016


Although I think "if var" should stay (probably just because of symmetry with "if let"), I have minor concerns with this proposal, as it brings up a more fundamental issue in the evolution process:
When is a decision final?

I guess it's hard to find the balance between discussing the same things over and over vs. stubborn insisting on a idea that is not as good as expected, but independent from this particular proposal, I think revising a decision should be done with caution, and that it is good that this discussion was started by a member of the Swift team…
Maybe it's possible to formalize the process so that an accepted proposal will not automatically be included in a future release, but rather has to pass a "veto-phase" after it has been implemented in a beta and people got a chance play with it (cancellation should stay an exception, though).

Back to the topic, I don't think "if var" and "guard var" brings more confusion than, for example, the difference between struct and class:
var and let always introduce a new value, and never change properties of something that already exists.
Additionally, I think
if let x = x {
	var x = x
looks rather ugly with all those x-assignments.
Thinking of my own source, I mostly use "if let" with return values of functions, so there is no confusion at all.

The argument of symmetry doesn't apply to function parameters, and I'm not really opposed to remove the "var-option" there — although afaics, most languages don't enforce const on parameters (which has the benefit that struct and class are treated the same way… and const has no advantage in a narrow scope)

Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160128/24d88708/attachment.html>


More information about the swift-evolution mailing list