[swift-evolution] [Review] SE-0048: Generic Type Aliases

Howard Lovatt howard.lovatt at gmail.com
Tue Mar 29 16:56:34 CDT 2016


Personally I find typealias useful for giving a friendly name to long types
and informative names to types in general. This applies to generic types as
much as non-generic, e.g.:

    typealias Vec4<T: Numerical> = (T, T, T, T)
    typealias Mat4<T: Numerical> = (Vec<T>, Vec<T>, Vec<T>, Vec<T>)

Further I would like to be able to add additional constraints that are not
part of the rhs of the alias, e.g.:

    typealias VecSparse<T: Numerical> = Dictionary<Int, T>
    typealias MatSparse<T: Numerical> = Dictionary<Int, VecSparse<T>>

On Friday, 25 March 2016, Dave Abrahams via swift-evolution <
swift-evolution at swift.org> wrote:

>
> on Thu Mar 24 2016, Douglas Gregor <dgregor-AT-apple.com> wrote:
>
> > Hello Swift community,
> >
> > The review of SE-0048 "Generic Type Aliases" begins now and runs through
> March 29, 2016. The proposal is available here:
> >
> >
> https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
> > Reviews are an important part of the Swift evolution process. All
> reviews should be sent to the swift-evolution mailing list at
> >
> > https://lists.swift.org/mailman/listinfo/swift-evolution <
> https://lists.swift.org/mailman/listinfo/swift-evolution>
> > or, if you would like to keep your feedback private, directly to the
> > review manager. When replying, please try to keep the proposal link at
> > the top of the message:
> >
> > Proposal link:
> >
> >
> https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
> > Reply text
> >
> > Other replies
> >  <https://github.com/apple/swift-evolution#what-goes-into-a-review-1>What
> goes into a review?
> >
> > The goal of the review process is to improve the proposal under review
> > through constructive criticism and, eventually, determine the
> > direction of Swift. When writing your review, here are some questions
> > you might want to answer in your review:
> >
> > What is your evaluation of the proposal?
> >
> > Is the problem being addressed significant enough to warrant a change
> > to Swift?
>
> That's my biggest question about this proposal.  Yes, as the proposal
> says, generic type aliases fill an obvious functional gap.  But what
> real-world problems are they solving and why should adding them be a
> priority?
>
> --
> Dave
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <javascript:;>
> https://lists.swift.org/mailman/listinfo/swift-evolution
>


-- 
-- Howard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160330/97310737/attachment.html>


More information about the swift-evolution mailing list