- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
deprecation of List.--
Mon, 2010-05-17, 17:02
For sure there is a reason.. someone can point it out? "filterNot(ys contains)" is a pretty verbose replacement. The definition of '--' in Subtractable seems to allow for a -- in List.
iulian
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
iulian
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
Mon, 2010-05-17, 17:57
#2
Re: deprecation of List.--
On Mon, May 17, 2010 at 6:02 PM, Iulian Dragos <iulian.dragos@epfl.ch> wrote:
For sure there is a reason.. someone can point it out? "filterNot(ys contains)" is a pretty verbose replacement. The definition of '--' in Subtractable seems to allow for a -- in List.The problem is that +, ++, -, -- come in a package: any class that supports one also supports the others. And List.+ is
impossible because of the bad interaction with String +.
You might be tempted to use `diff` but it does something different if the list has duplicates.
scala> List(1, 1, 1, 1) -- List(1)
warning: there were deprecation warnings; re-run with -deprecation for details
res0: List[Int] = List()
scala> List(1, 1, 1, 1) diff List(1)
res1: List[Int] = List(1, 1, 1)
Cheers
-- Martin
On 17 May 2010 17:02, Iulian Dragos <iulian.dragos@epfl.ch> wrote:
--
Kevin Wright
mail/google talk: kev.lee.wright@googlemail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda