- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
[Fwd: Re: continue keyword]
Thu, 2009-03-19, 19:34
Detering Dirk wrote:
> I would be really, really interested in seeing a simplified
> (but not oversimplified!) fully functional prototype version
> of this usecase written in your style, and than let us
> (well, not me, but the experts ;) ) show how that would be
> solved in The Scala Way.
> It seems a sufficiently complex, but not too complex,
> properly isolated problem for a showcase, and even coming
> out of real world necessities.
A hearty +1 to that!
I'm someone from the Java / traditional procedural OO world who has been
watching Scala and other functional hybrids with interest (though as yet
without time to devote to really getting my feet wet). Though by all rights
my bias should be for adding the continue and break (I've written plenty of
file parsing loops, and have used these constructs now and then), from what I've seen,
I find the alternative compelling, and actually find
data.takeWhile(_.time < endTime).filter(_.time > startTime).map(line
=> println("Found "+line.recordType+" at "+line.time))
quite comprehensible even though my grasp of Scala syntax is shaky at best.
As someone still deciding whether and to what degree to take the plunge into Scala
or FP in general, it would be EXTREMELY useful to see the non-simplified version of
this in several forms:
* The procedural without continue and break
* The procedural with continue and break (even if hypothetical)
* However many FP ways of doing it the various FP proponents think are better,
perhaps including one or more FP version using continue and break
* Perhaps a version with a bit of DSL work to soup up the readability?
It doesn't even matter if there is remotely a consensus afterwards as to which
is more readable, it would still be valuable.