[swift-users] String initializers and developer ergonomics

Zach Waldowski zach at waldowski.me
Mon May 9 12:28:30 CDT 2016


On Mon, May 9, 2016, at 01:25 PM, Joe Groff via swift-users wrote:
> This definitely strikes me as a problem. The String<T>(_:) constructor is
> very easy to call by accident if you're trying to hit another unlabeled
> initializer. It also strikes me as not particularly "value-preserving",
> since stringifying many types loses information. Perhaps we should
> propose giving it a label, String(printing:) maybe?

I've been wondering about this since String(reflecting:) came about, as
plain print() is capable of doing about the same amount of reflection as
debugPrint(). I don't want to get into the bikeshedding of it, but I'd
really like to see printing String initializer get a verb label. It's
pretty strongly against the API guidelines for initializers.

Sincerely,
  Zachary Waldowski
  zach at waldowski.me


More information about the swift-users mailing list