[swift-evolution] [Discussion] Modernizing Playground Literals

T.J. Usiyan griotspeak at gmail.com
Wed Feb 17 23:48:10 CST 2016

I agree that a general literal syntax is beyond the scope of this proposal
but, in my opinion, the "clear, measurable, immediate benefit to Swift"
would be a means to have literal support that might not force you to accept
all of the literal types inhabitants. As it stands, there are many types
which are poorly served by the literal types available. If I want to use a
string as a literal for my type, I must accept all possible strings (or
blow up at runtime). I would gladly put in extra work to allow a literal
syntax for my type that could be compile time checked.

This is not the literal syntax that I want. It is, however, the literal
syntax that is within scope.


On Tue, Feb 16, 2016 at 1:45 PM, Erica Sadun via swift-evolution <
swift-evolution at swift.org> wrote:

> > On Feb 16, 2016, at 10:31 AM, Daniel Vollmer via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> >
> >> On 15 Feb 2016, at 21:16, Erica Sadun via swift-evolution <
> swift-evolution at swift.org> wrote:
> >>
> >> Presented for discussion and feedback. Thank you in advance for your
> thoughts.
> >>
> >> -- Erica
> >>
> >> Modernizing Playground Literals
> >
> > [snip]
> >
> > Ignoring the fact that I think Erica’s proposal is an improvement over
> the current state, a more general solution would be something like
> user-defined literals in C++11 (with whatever syntax). A playground could
> then pre-import the definitions of any literal types it wants to support,
> without having to change the language / compiler any time a new literal
> type is added.
> >
> > I’m not sure whether this use-case is so important (or I’m overlooking
> something basic) that these items need such special treatment (e.g.
> #-prefix); couldn’t one just offer global factory functions for the
> literals in question and treat them specifically in Xcode’s playground UI?
> >
> >       Daniel.
> It's certainly beyond the scope of this proposal.  I'm not sure if it
> passes the Lattner test: "Is there a clear, measurable, immediate benefit
> to Swift developers rather than being of value for its cleverness?" There's
> also a general macro system that I know keeps coming up on these threads
> that ??Dave Abrahams?? is working on for Swift 4 or later.
> -- Erica
> _______________________________________________
> 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/20160218/3e936a4a/attachment.html>

More information about the swift-evolution mailing list