[swift-evolution] Revisiting SE-0041 Names

Erica Sadun erica at ericasadun.com
Mon Jun 27 13:31:04 CDT 2016

> On Jun 27, 2016, at 12:13 PM, Dave Abrahams <dabrahams at apple.com> wrote:
> on Mon Jun 27 2016, Erica Sadun <erica-AT-ericasadun.com <http://erica-at-ericasadun.com/>> wrote:
>> So a protocol of `Syntax.AcceptsIntegerLiteralValues` or
>> `Syntax.AutoconvertsIntegerLiteralValues` might
>> better explain what this is doing and the intent of the protocol. It
>> ain't short but it's a hella lot clearer.
> Being clear isn't helpful when it clearly implies the wrong meaning.
> What's essential about this protocol neither that it “accepts” nor that
> it “autoconverts” anything.  It's that it allows allows an integer
> literal to be interpreted as an expression having the conforming type,
> or to put it differently, it confers integer literal syntax upon the
> conforming type.

I suppose  "Syntax.AllowsIntegerLiteralToBeInterpretedAsExpressionOfConformingType"
is a tiny bit too wordy?

Putting on my hat of extreme pedantry:

Conformance does "accept" integer literals. By conforming, this protocol
allows them to be interpreted as expressions of the conforming type. That
reads as acceptance to me.

I'm not sure if you could call this promotion, casting, interpretation or whatever
but the way you describe it sounds exactly backwards from the way it's used. 

You say "It confers integer literal syntax", which reads to me as "Oh great, I can
use a floating point number as an integer literal. Great, let x: Int = 4.2".

When I see it used, I think "Conforming types consume integer literal syntax as native",
which is more `let x: Double = 1` and `let y Double = 2.5 * myOtherDouble * 4`.

And then grabbing a paintbrush of many colors, perhaps "Syntax.IntegerLiteralConsumer"?

-- E

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160627/4d9dd22a/attachment.html>

More information about the swift-evolution mailing list