Scala Collections: Why Not?

Поділитися
Вставка
  • Опубліковано 29 лис 2024

КОМЕНТАРІ • 31

  • @shirankao69
    @shirankao69 10 років тому +15

    Paul, thanks for all your work on Scala.

  • @CarlosSaltos
    @CarlosSaltos 10 років тому +4

    Interesting video: if you take the complaints apart, you can learn interesting things about the Scala collections internals

  • @vincemarco
    @vincemarco 10 років тому +1

    Very insightful. Any plans for an OSS library of collections for scala that are "beautifully" designed? Doesn't seem necessary to throw away the whole language over some collection design issues. I know ... tip of the iceberg and all that. Just saying, that a solution needs to start somewhere, and I don't see any other languages coming close to leveraging both OO and FP, providing type safety, and providing a high level of interoperability with Java. Seems like an appropriate place to start. I would certainly switch over to using an OSS collections library that was easier, more straight-forward, less error prone, more consistent, and better performing.

  • @VandroiyIII
    @VandroiyIII 10 років тому +4

    lol... this is genuinely funny to watch. One more language gone from the check-list; I wouldn't trust a language producing THAT.

  • @jonathanmerritt8712
    @jonathanmerritt8712 10 років тому +7

    I wonder how much time PaulP has spent with Haskell? I'm only learning Haskell at the moment (after a few years with Scala), but its emphasis on purity and its lack of subclassing seem to be just what he's looking for. I haven't gone far enough yet to see what the limitations might be of wide-ranging typeclass use, but it seems great so far.

    • @stoyandamov863
      @stoyandamov863 8 років тому +1

      +Jonathan Merritt or Clojure

    • @SaarWexler
      @SaarWexler 6 років тому +1

      type system is overappreciated

  • @TheRaspPie
    @TheRaspPie 9 років тому

    I think his problem really is that "won't fix" bug status. If we do this, the language has no chance to fix. I always found the best about Scala not the functional constructs or other features, but really the way the language inventors want to prevent it from standing still. Everytime Martin Odersky talks about Scala and plans in the future, I have a strong feeling about Scala because I have the confidence that it will evolve. After Paul's talk I was shocked about Typesafe preventing these fixes. Scala started as an educational language, but it reached the point where Typesafe had to offer backwards compatibility and restrict evolving just because business customers required it :(

  • @tepan
    @tepan 10 років тому +7

    List(1, 2, 3).toSet()
    warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want.
    123456789.round
    warning: method round in class RichInt is deprecated: This is an integer type; there is no reason to round it. Perhaps you meant to call this on a floating-point value?

    • @raymondhill7837
      @raymondhill7837 Рік тому

      List(1, 2, 3) contains("abc") still compiles in 2023. Very loose typing.

  • @FabianLopez_lomba
    @FabianLopez_lomba 10 років тому +14

    is it me or he sounds like he is going mad, he has seen stuff

  • @kevalan1042
    @kevalan1042 9 років тому +2

    I don't get the gripe with the hashcode of a set. I get that some elements may hash to the same thing and be counted only once in the sum, but why is that a problem?

  • @abhishes
    @abhishes 8 років тому +2

    I wonder if scala community do anything for the points raised by Phillip. I just did a List(1, 2, 3) contains "your mom" on scala 2.11.7 and it did not raise any error even though I am looking for an string in a list of int.

    • @justpk5773
      @justpk5773 8 років тому +1

      Why it will raise an error? It gives a boolean.

    • @abhishes
      @abhishes 8 років тому +4

      I meant compiler error. Since the List is type of Int and we are trying to look for a string in that list.

  • @epi6676
    @epi6676 6 років тому

    Press F to pay respects

  • @justpk5773
    @justpk5773 8 років тому

    Now (Nov 2016) all the mentioned errors are fixed?

    • @andrewg.a.7661
      @andrewg.a.7661 4 роки тому

      most of the problems are design issues; you cannot really fix design issues because it would break backwards compatibility

  • @kevalan1042
    @kevalan1042 9 років тому

    Also, it's weird to expect any functional invariants to hold when your "function" is something as non-deterministic as System.nanoTime % 1000000.

  • @YanDoroshenko
    @YanDoroshenko 7 років тому +2

    Map still looks the same. 2.4.2017

  • @raulbache654
    @raulbache654 7 років тому

    The classic definition of round.

  • @jedichenbin
    @jedichenbin 10 років тому +1

    Paul, I don't think the example you gave about the SortedSet is valid.
    If you have a Set, and do `map`, the result set shall not contain the duplicated elements. That's why SortedSet(3,6,9) map f has only one element.

    • @goawaygoawaynow
      @goawaygoawaynow 10 років тому +3

      His point here is (and it becomes clear later on) that map over a Set should not return a Set. Exactly because of this.

    • @kevalan1042
      @kevalan1042 9 років тому +1

      goawaygoawaynow What else would you expect when mapping over a set?? Anything else would be quite weird to me. In Haskell when you map over a Set of A with a function A->B you get (guess what) a Set of B.

    • @yawaramin4771
      @yawaramin4771 8 років тому

      I would expect the 'top' type in the hierarchy of that particular collection class (disregarding AnyRef, of course). E.g., Set#map should return an Iterable[B]. To see an example of this in the standard library itself, see Some#map, which returns an Option[B] (not a Some[B]).

    • @kevalan1042
      @kevalan1042 8 років тому

      +Yawar Amin Your Option example seems a bit facetious. Some and None are analogous to List's Cons (::) and Nil. Do you think Cons#map should also yield an Iterable? If yes, then I guess our tastes are diametrically opposed :)

    • @yawaramin4771
      @yawaramin4771 8 років тому +1

      Kev Alan when you have subtyping in a functional programming language, all the usual bets are off :-)

  • @NoNonsenseMeditation
    @NoNonsenseMeditation 10 років тому +5

    Very funny, very interesting talk. Nevertheless the problem's highlighted don't seem to effect my day to day coding. I guess there needs to be a balance, like I love the fact that Lists of tuples and Maps fluidly intertwine, but Paul seems to think that kind of thing over-complicates things. And I like how ".par" gives me 4x speed up on a quad core computer - I don't want to implement my own!!
    As for the .view not really working, .iterator and .reverseIterator work just fine and can be used to achieve the same speedup given.
    Now his argument against the map associativity not working for Set and BitSet doesn't really hold because no one ever said any type with a map operation is a Functor - there is no inconsistency.
    Sounds like it's really painful to implement Scala and that's what he hates, but for me I find coding in Scala very pleasurable.
    123456789.round is just as weird as doing 123456789.toFloat, that's not Scala that's float.
    The Set apply method being contains is awesome, means you can do:
    scala> List(1, 2, 1, 3, 4).partition(Set(1, 4))
    res54: (List[Int], List[Int]) = (List(1, 1, 4),List(2, 3))
    It's swings and roundabouts, but I still love Scala.

  • @bulbulahmed6795
    @bulbulahmed6795 9 років тому

    Total wast of time seeing this funny gui

  • @TheRaspPie
    @TheRaspPie 9 років тому +1

    I think his problem really is that "won't fix" bug status. If we do this, the language has no chance to fix. I always found the best about Scala not the functional constructs or other features, but really the way the language inventors want to prevent it from standing still. Everytime Martin Odersky talks about Scala and plans in the future, I have a strong feeling about Scala because I have the confidence that it will evolve. After Paul's talk I was shocked about Typesafe preventing these fixes. Scala started as an educational language, but it reached the point where Typesafe had to offer backwards compatibility and restrict evolving just because business customers required it :(