[Swift-devel] Problem with iterate
Mihael Hategan
hategan at mcs.anl.gov
Sat Feb 20 14:10:34 CST 2010
On Sat, 2010-02-20 at 13:55 -0600, Mihael Hategan wrote:
> On Sat, 2010-02-20 at 19:27 +0000, Ben Clifford wrote:
> > >
> > > > So what would that do to SwiftScript? Well you could get rid of any
> > > > partial assignment to arrays and say the equivalent of:
> > >
> > > I think that convergence loops (i.e. "do this repeatedly until some
> > > non-trivial condition becomes true") would not be possible then unless
> > > recursion was used.
> >
> > I was imagining having a high level construct to replace "iterate" that
> > looks quite like iterate but is more restricted in its use eg takes a
> > some (laststate -> newstate) operation (the iterate body now) and takes
> > some (newstate -> boolean) operation (the until clause now).
>
> That would probably be better for most cases. Though I'm not sure how
> exactly this would be expressed.
>
> I think, in a sense, the choice of foreach (and array indices) instead
> of map (and lists) was due to a desire to make this close to C because
> of the belief that our target audience would then have an easier time
> adapting to it.
>
> Which is funny because the non-restrictive nature of C is, I think, what
> makes it easy to write the wrong program which is what you are trying to
> get rid of.
Which is probably why we have the ongoing debates about language vs.
library:
Achieving a goal in Swift requires knowledge of the inner workings of
Swift which are mostly hidden from the users (i.e. the incantation
needed to do something is not obvious and is usually discovered by
asking on the mailing list), whereas a library, while still requiring
knowledge of the inner workings, would at least give the users a better
path towards knowing those inner workings.
I think they are both bad, in that the knowledge of said inner workings
are complexities that we want to hide. Except the current language is
doing a poor job at not requiring that knowledge.
More information about the Swift-devel
mailing list