[Pitch] Unify preset static "initializers"


(Bas Broek) #1

Hi all,

I was wondering the other day why "static initializers", as I will call them, are not unified:

CGRect.zero

vs

UIColor.blackColor() - which will be UIColor.black() in Swift 3.

... which both do pretty much the same; they are used as convenience initialization for the specific type. I think their intent will be clearer though, when all of them either become static vars (as with CGRect.zero) or static funcs (as with UIColor.black()).

I, though, am not sure which would be the best option.

So I'd like to ask you all two questions:

- Do you think these should be unified? Why (not)?
- If yes, should funcs or vars be used?

Thanks,

Bas


(Vladimir) #2

I feel that obviously UIColor.blackColor() should be transformed to UIColor.black property, but I'm not sure if this could be discussed in this mailing list(Swift evolution).

(P.S. all your 3 emails were posted in list)

···

On 03.06.2016 17:45, Bas Broek via swift-evolution wrote:

Hi all,

I was wondering the other day why "static initializers", as I will call them, are not unified:

CGRect.zero

vs

UIColor.blackColor() - which will be UIColor.black() in Swift 3.

... which both do pretty much the same; they are used as convenience initialization for the specific type. I think their intent will be clearer though, when all of them either become static vars (as with CGRect.zero) or static funcs (as with UIColor.black()).

I, though, am not sure which would be the best option.

So I'd like to ask you all two questions:

- Do you think these should be unified? Why (not)?
- If yes, should funcs or vars be used?

Thanks,

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


(TJ Usiyan) #3

I believe that the change for UIColor.black and friends has already been
accepted. I believe that it is the result of the guidelines but I didn't
find a specific reference just now while looking.
TJ

···

On Fri, Jun 3, 2016 at 12:08 PM, Vladimir.S via swift-evolution < swift-evolution@swift.org> wrote:

I feel that obviously UIColor.blackColor() should be transformed to
UIColor.black property, but I'm not sure if this could be discussed in this
mailing list(Swift evolution).

(P.S. all your 3 emails were posted in list)

On 03.06.2016 17:45, Bas Broek via swift-evolution wrote:

Hi all,

I was wondering the other day why "static initializers", as I will call
them, are not unified:

CGRect.zero

vs

UIColor.blackColor() - which will be UIColor.black() in Swift 3.

... which both do pretty much the same; they are used as convenience
initialization for the specific type. I think their intent will be clearer
though, when all of them either become static vars (as with CGRect.zero) or
static funcs (as with UIColor.black()).

I, though, am not sure which would be the best option.

So I'd like to ask you all two questions:

- Do you think these should be unified? Why (not)?
- If yes, should funcs or vars be used?

Thanks,

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

_______________________________________________

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