-1

Something like `42` will make things confusing.


On Thu, Mar 9, 2017 at 5:53 PM David Sweeris via swift-evolution <
swift-evolution@swift.org> wrote:

>
> On Mar 9, 2017, at 04:40, Ross O'Brien via swift-evolution <
> swift-evolution@swift.org> wrote:
>
> I could see a purpose for identifiers which started numbers but weren't
> entirely numerical.
> e.g.
> enum Dimensions { case `2D`, `3D` }
> enum DiceRoll { case d6, `2d6` }
> func roll(dice: DiceRoll) -> Int { ... }
> roll(.`2d6`)
>
> I'm not sure I see one for identifiers which are entirely numerical.
>
>
> That's certainly a much easier sell... How does "_" fit into this? I know
> `123_456` is a valid integer literal and that `_1` is a valid identifier. I
> don't know if `_1` is a valid integer literal.
>
> I'd *like* to support purely numeric identifiers, but I can't think of a
> way around the ambiguity of `3.0`. Maybe only allow it if the enclosing
> type isn't ExpressibleByIntegerLiteral? It feels more than a bit odd,
> though, to have a property name's validity depend on whether or not it's in
> a ExpressibleByIntegerLiteral type.
>
> - Dave Sweeris
>
> _______________________________________________
> 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

Reply via email to