[swift-evolution] [Discussion] Design guideline rule for `:`
Adrian Zubarev
adrian.zubarev at devandartist.com
Wed Jun 22 06:57:01 CDT 2016
I follow exactly the same flow.
Even if this is my personal preference, I do not like x : y at all at any corner of the language, just because it does look somehow strange to me.
// This looks much clearer to me
type TypeName: BaseType {
var value: SomeType
func generic<T: BaseType>(dictionary: [String: T]) { … }
}
// Compared to this
type TypeName : BaseType {
var value : SomeType
func generic<T : BaseType>(dictionary : [String : T]) { … }
}
--
Adrian Zubarev
Sent with Airmail
Am 22. Juni 2016 um 13:50:44, Vladimir.S (svabox at gmail.com) schrieb:
Good question. I also asked myself if there is such guideline.
I thought we have some kind of guideline, as parameters in methods/funcs in
Swift has `func foo(param: Type)` format, not 'func foo(param : Type)'. So
for myself I decided that I should follow this syntax anywhere I need to
place `:`.
On 22.06.2016 14:40, Adrian Zubarev via swift-evolution wrote:
> Should there be a design guideline rule for colons |:| in Swift?
>
> I see people doing things like this:
>
> |protocol A : B {} // VS. protocol A: B {} |
>
> |func foo<T : A>() -> T { … } // VS. func foo<T: A>() -> T { … } |
>
> |var value : Type // VS. var value: Type |
>
> |[key1 : value1, key2 : value2] // VS. [key1: value1, key2: value2] |
>
> * I prefer the second style, where there is no whitespace between lhs and
> the |:| symbol and there is also a whitespace after |:|. Example:
> |something: somethingElse|
>
>
>
> --
> Adrian Zubarev
> Sent with Airmail
>
>
>
> _______________________________________________
> 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/20160622/dee01564/attachment.html>
More information about the swift-evolution
mailing list