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

Paul Cantrell cantrell at pobox.com
Sun Jan 31 12:57:08 CST 2016


-1 on “bind” for two reasons:

(1) Right now, variable/property declarations always use the word “let” or “var” (with the exception of the for loop iterator). That’s a nice consistency.

(2) It’s not clear on reading whether “bind” means “new declaration” or “alias.” It vaguely suggests I might expect this to work:

	let x = 1
	bind y = x
	y += 10
	// x == 11

I do also find “if let” a bit awkward because ungrammatical of it how is — and this is doubly so for “if case” — but I don’t find “if bind" any better on this front. Ultimately, despite their English grammar illogic, “if let” and even “if let x = x” make enough programming language sense that I accepted them, took them as a Swift idioms, and got comfortable with them pretty quickly.

Cheers, P


> On Jan 30, 2016, at 7:50 PM, Howard Lovatt via swift-evolution <swift-evolution at swift.org> wrote:
> 
> +1 for `bind`. I dislike the use of the same keyword for two different purposes. Also `if let x = x` is confusing for beginners (by beginners I mean beginners to Swift not to programming) since:
> 
>   1. `let x = x` is, outside of binding, an error. 
>   2. Beginners quite rightly say "`x` already equals `x`!".
> 
> On Friday, 29 January 2016, Joe Groff via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
> > On Jan 28, 2016, at 10:05 AM, Erica Sadun <erica at ericasadun.com <javascript:;>> wrote:
> >
> > Do you realize how much confusion it would save if Swift just went with
> >
> > if bind foo = bar {...}
> >
> > with let semantics?
> 
> I don't see how changing the keyword changes anything, no.
> 
> -Joe
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <javascript:;>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> 
> -- 
>   -- Howard.
> 
> _______________________________________________
> 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/20160131/415dadb1/attachment.html>


More information about the swift-evolution mailing list