This page is no longer maintained — Please continue to the home page at www.scala-lang.org

generators first in for comprehensions

1 reply
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.

Looking at ticket #3a3a3a and glancing at the implementation, I can't see any reason it wouldn't be straightforward
to generalize it to allow ifs and vals to come before the first generator. The usefulness is suspect, but I can
imagine places where the distinction would be annoying (for instance, a hypothetical scala-generating program
would be simplified by not having to confirm a generator comes first.)

But I don't want to implement it only to find out it would be unwelcome, so...

a) if it's implemented nicely it would most likely be added
b) we know this is a wontfix (which is even better, as I could close the ticket without expending code)
c) ... since my underlying goal here is to reduce the open ticket count, hopefully there is no third option

Thanks,

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: generators first in for comprehensions

On Thu, Feb 19, 2009 at 2:38 PM, Paul Phillips wrote:
> Looking at ticket #3a3a3a and glancing at the implementation, I can't see any reason it wouldn't be straightforward
> to generalize it to allow ifs and vals to come before the first generator. The usefulness is suspect, but I can
> imagine places where the distinction would be annoying (for instance, a hypothetical scala-generating program
> would be simplified by not having to confirm a generator comes first.)
>
> But I don't want to implement it only to find out it would be unwelcome, so...
>
> a) if it's implemented nicely it would most likely be added
> b) we know this is a wontfix (which is even better, as I could close the ticket without expending code)
> c) ... since my underlying goal here is to reduce the open ticket count, hopefully there is no third option
>
The cost is that we then have to change the spec and all documentation
to take account of this case. Unless there's a convincing use case it
looks like a wont fix to me.

Cheers

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland