Optional argument types

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Sep 25 07:59:19 PDT 2012


then nominal will be? :)

On Tue, Sep 25, 2012 at 3:37 PM, Andreas Rossberg <rossberg at google.com>wrote:

> On 25 September 2012 15:31, Andrea Giammarchi
> <andrea.giammarchi at gmail.com> wrote:
> > That's a hell of a question ... shapes speaking I'd say structural, since
> > AFAIK shapes are those boosted up more, isn't it?
> >
> > That would solve String VS string and Array VS Arguments which is, I
> > believe, kinda desired.
> >
> > Which one would you chose ?
>
> I assume that most people would probably prefer structural types in
> principle, but the problem is that they induce far, far more expensive
> runtime checking (easily an order of magnitude). Which is why guards
> and trademarks were proposed as a more conservative, nominal
> mechanism.
>
> Generally speaking, retrofitting something type-like on an untyped
> language is a *very* hard problem. It has been tried with many
> languages and has succeeded for very, very few. You can read lots and
> lots of research papers on the subject.
>
> Fortunately, though, we have top-notch expertise on that topic on
> TC39, e.g. Sam TH. ;)
>
> /Andreas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120925/81481e12/attachment.html>


More information about the es-discuss mailing list