- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
2.7.7 -> 2.8.0 changes
Hi,
I found the following somewhere on the Web and it seems to do the right
thing (sort of) under 2.7.7. However under 2.8.0 I get an error
message. Is it something trivially simple I am missing?
class Mapper[A,B] ( data : List[A] , function : A => B ) {
val pmap = {
val buffer = new Array[B] ( data.length )
// Ranges are lazy but we need strict so the .toList
val mappers = for ( index <- ( 0 until data.length ).toList ) yield
Futures.future { buffer ( index ) = function ( data ( index ) ) }
for ( mapper <- mappers ) mapper ( )
buffer
}
}
scalac -optimise Pi_Scala_ParMap.scala
Pi_Scala_ParMap.scala:11: error: cannot find class manifest for element
type B
val buffer = new Array[B] ( data.length )
^
Pi_Scala_ParMap.scala:15: error: mapper of type Nothing does not take
parameters
for ( mapper <- mappers ) mapper ( )
^
two errors found










Re: 2.7.7 -> 2.8.0 changes
On Tue, Apr 6, 2010 at 2:57 PM, Russel Winder <russel [at] russel [dot] org [dot] uk> wrote:
--
Daniel C. Sobral
I travel to the future all the time.
Re: 2.7.7 -> 2.8.0 changes
On Tue, 06 Apr 2010 15:40:26 -0300, Daniel Sobral wrote:
> [A,B : Manifest]
Interesting - I haven't seen this before . What is is called, and does it
do?
Re: Re: 2.7.7 -> 2.8.0 changes
replace [A,B] with [A,B : Manifest], or add (implicit man: Manifest[B])
On Wed, Apr 7, 2010 at 2:53 AM, Sam Stainsby <sam [at] sustainablesoftware [dot] com [dot] au> wrote:
--
Daniel C. Sobral
I travel to the future all the time.
Re: 2.7.7 -> 2.8.0 changes
On Wed, 07 Apr 2010 08:33:11 -0300, Daniel Sobral wrote:
> It's equivalent to my alternate solution:
>
> replace [A,B] with [A,B : Manifest], *or add (implicit man:
> Manifest[B])*
Except in the second case you have 'man', which can be accessed within
the class.
Re: Re: 2.7.7 -> 2.8.0 changes
On 7 April 2010 12:47, Sam Stainsby <sam [at] sustainablesoftware [dot] com [dot] au> wrote:
--
Kevin Wright
mail/google talk: kev [dot] lee [dot] wright [at] googlemail [dot] com
wave: kev [dot] lee [dot] wright [at] googlewave [dot] com
skype: kev.lee.wright
twitter: @thecoda
Re: Re: 2.7.7 -> 2.8.0 changes
2010/4/7 Kevin Wright <kev [dot] lee [dot] wright [at] googlemail [dot] com>
Re: Re: 2.7.7 -> 2.8.0 changes
On 7 April 2010 13:20, Dimitris Andreou <jim [dot] andreou [at] gmail [dot] com> wrote:
--
Kevin Wright
mail/google talk: kev [dot] lee [dot] wright [at] googlemail [dot] com
wave: kev [dot] lee [dot] wright [at] googlewave [dot] com
skype: kev.lee.wright
twitter: @thecoda
Re: 2.7.7 -> 2.8.0 changes
>> (*Make that implicitly[Manifest[B]] )
Nice! That should reduce some clutter in my code.
Re: Re: 2.7.7 -> 2.8.0 changes
On Wed, Apr 7, 2010 at 6:53 AM, Sam Stainsby
wrote:
> On Tue, 06 Apr 2010 15:40:26 -0300, Daniel Sobral wrote:
>> [A,B : Manifest]
> Interesting - I haven't seen this before . What is is called, and does it
> do?
It's called a context bound. The array SID talks a bit about it.
Best,
Ismael