On Tue, Feb 10, 2015 at 10:15 AM, Keean Schupke <[email protected]> wrote:

> A further point would be if you can iterate a String, why would you want
> to convert it into a List?
>

Well, speaking hypothetically, of course, you might want to do so in order
to ask ignorant questions about comprehensions....


> The tendency to convert everything to lists for processing is working
> around a deficiency in the design of the language.
>

In part, I think you are saying that we really need a generalized notion of
iterable things. I agree. I also think that if we *are* going to build an
output aggregate, it's useful to be able to produce whatever type is needed
without going through a list as an intermediate form.

The main difference I see between comprehensions and nested iterations is
that the comprehension provides a syntactically clearer way to express the
fabrication. You can certainly do that with nested iterations, but it tends
to need a mutable idiom. I don't object to mutation, certainly, but it's
useful to have a non-mutating idiom available.

You have talked about using a monad in all this. I'm not planning any
intrinsic support for monads in the BitC core.

Generic iterators allow algorithms to be expressed in a way that they do
> not rely on the type of the collection being a list, but intact relate the
> algorithm directly to the access-pattern required (forward, bi-direction,
> indexed, random, bifurcating, 2-dimensional etc...).
>

I agree. Though I also find the sheer complexity of the various iterator
schemes in the standard C++ library bewildering.


shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to