[Swift-devel] Standard Library, take II

Tim Armstrong tim.g.armstrong at gmail.com
Mon Feb 2 16:56:26 CST 2015


Oh I didn't realise there were keyword args in K.  So K supports optional
arguments but the caller has to specify them by name, not position?

- Tim

On Mon, Feb 2, 2015 at 4:18 PM, Mihael Hategan <hategan at mcs.anl.gov> wrote:

> On Mon, 2015-02-02 at 15:46 -0600, Tim Armstrong wrote:
> > I think that sounds good to me.
> >
> > I think with overloading, I might attempt to implement overloading in the
> > generic way (such that it would support user-defined functions), but only
> > enable it for library functions by default.  This would let us experiment
> > with it to see how it works, but reduces the possibility of bugs for the
> > time being.
> >
> > I think the keyword arguments needs some discussion.   I was thinking
> that
> > we'd have optional positional arguments only (like C++).  I think in any
> > case I'd like to put keyword arguments into the "future" category.  I'm
> > open to discussion but I think we can put that off too.
>
> They are already in K, but noted.
>
> I'm inclined to change most library functions with keyword args (such as
> substring(str, start, [end =...]) to overloaded ones, since there is no
> good reason to write:
>
> s1 = substring(s, 0);
> s2 = substring(s, 1, end = 5);
>
> rather than
>
> s2 = substring(s, 1, 5);
>
> I think that, from this perspective, overloading is roughly equivalent
> to optional positional arguments.
>
> Mihael
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20150202/10c3ad02/attachment.html>


More information about the Swift-devel mailing list