Live data from Hacker News

Scala founder: Language due for 'fundamental rethink'

infoworld.com

81–90 of 118 posts

Re: Scala founder: Language due for 'fundamental rethink'

#81

How did Odersky miss Yammer's citing Scala's complexity as a reason for moving away from it? Odersky said: > In terms of complexity, I don't know whether Yammer featured that, but you definitely do hear that a lot [from] many people. The first paragraph (after introductory greetings) of Yammer's letter which explains its action [1]: > Scala, as a language, has some profoundly interesting ideas in it. That's one of th…

Indeed. Another example from the fourth paragraph of the letter:

"Scala, as a language, has some profoundly interesting ideas in it. That's one of the things which attracted me to it in the first place. But it's also a very complex language. The number of concepts I had to explain to new members of our team for even the simplest usage of a collection was surprising: implicit parameters, builder typeclasses, "operator overloading", return type inference, etc. etc."

It seems very clear the language's complexity was a major problem for Yammer.

Re: Scala founder: Language due for 'fundamental rethink'

#82
post #21
post #10

> Essentially, the fusion of [functional and object-oriented programming] can have a power that neither of the two paradigms individually can have. I tend to disagree. OOP can borrow some FP stuff (as we see with map/each/select/reject in Ruby for instance, or lambda's in Java); or to take it broader: imperative can borrow some from declarative. But "fusing" the two will cause FP's ease-of-reasoning ("just functions…

So you don't use type classes in Haskell? Neither touch F# or OCaml. Nor CLOS in Lisps.

Correct me if I'm wrong, but isn't OO in OCaml frowned-upon, or at least not used frequently by seasoned programmers?

Not an OCaml programmer myself, but I heard this multiple times. For example, in Real World OCaml [ https://realworldocaml.org/v1/en/html/objects.html ]), and I quote from Chapter 11:

> You might wonder when to use objects in OCaml, which has a multitude of alternative mechanisms to express the similar concepts. First-class modules are more expressive (a module can include types, while classes and objects cannot). Modules, functors, and data types also offer a wide range of ways to express program structure. In fact, many seasoned OCaml programmers rarely use classes and objects, if at all.

To be fair, the chapter goes on to explain why you'd want objects. It also states they are very different from objects as understood by other OO languages. I'd say OCaml is therefore a bad example for OO.

--

How are type classes in Haskell an OO feature?

Re: Scala founder: Language due for 'fundamental rethink'

#83
post #45

Earlier quoted context omitted.

I think there's a huge opportunity for FP+OO... but that OO will have to be rethought from first principles (which are lacking in OO). More specifically, I think OO-style code interactions are great but that they need to be separated from ambient mutability, subtyping, subclassing, inheritance, etc. Late binding/open corecursion is really cool however. I would like to see a language which starts with ML modules as a…

Uhm...you mean like Moby? http://moby.cs.uchicago.edu/

Perhaps, I'll take a look at it.

Re: Scala founder: Language due for 'fundamental rethink'

#84
post #45

Earlier quoted context omitted.

I think there's a huge opportunity for FP+OO... but that OO will have to be rethought from first principles (which are lacking in OO). More specifically, I think OO-style code interactions are great but that they need to be separated from ambient mutability, subtyping, subclassing, inheritance, etc. Late binding/open corecursion is really cool however. I would like to see a language which starts with ML modules as a…

I think there's a huge opportunity for FP+OO... but that OO will have to be rethought from first principles (which are lacking in OO). More specifically, I think OO-style code interactions are great but that they need to be separated from ambient mutability, subtyping, subclassing, inheritance, etc. This has already happened. Ideally, good object-oriented code should always prefer immutability over mutability, should…

> Ideally, good object-oriented code should always prefer

Really what I'm referring to is a language which outlaws instead of one that leaves it up to preference. And by outlaw I don't mean entirely, but instead a language which requires the programmer explicitly opt into these richer domains as they are needed.

My understanding is that while these principles are understood as valuable, OO is generally constructed as too permissive to enforce them.

In a similar story, unbounded recursion is generally "bad" in almost every part of a program---nobody likes mysteriously hanging programs---but only total languages have a formalism which allows you to profitably outlaw it.

So I'm convinced there are the beginnings of the theory of objects lurking around out there even if they rarely see the light of day (really) in practice. But I also recognize that modern functional semantics grew over the last 80 years. I don't think (maybe I'm wrong) that the whole package of OO has had so long to mature.

Re: Scala founder: Language due for 'fundamental rethink'

#85
post #45

Earlier quoted context omitted.

I think there's a huge opportunity for FP+OO... but that OO will have to be rethought from first principles (which are lacking in OO). More specifically, I think OO-style code interactions are great but that they need to be separated from ambient mutability, subtyping, subclassing, inheritance, etc. Late binding/open corecursion is really cool however. I would like to see a language which starts with ML modules as a…

What is "open corecursion"?

Corecursion is when you define the meaning of a type by a coalgebra like

    x -> F x
for some pattern functor F. So, for instance, defining an infinite stream like

    newtype Stream = Stream { runStream :: (X, Stream) }
is corecursion. The interesting part is that whatever defines the stream is forced to fix the Stream type immediately. Open (co)recursion in OO langauges occurs when the recursive type is left undefined (i.e., self is passed in). This allows you to change the type of the object at every step if desired.

The similar game in a recursive function might be defining face like so

    fact :: (Int -> Int) -> (Int -> Int)
    fact recur n = n * recur (n-1)
We "tie the knot" by passing fact to itself

    fix f = f (fix f)

    fix fact :: Int -> Int
which would allow us to add extra cases as needed

    let term recur n = if n == 0 then 1 else recur n

    > fix fact 3
    -- infinite loop
    > fix (term . fact) 3
    6
So this is a kind of "mixing" of recursive functions. Open corecursion lets you do OO-like "mixing" of corecursive functions.

Re: Scala founder: Language due for 'fundamental rethink'

#86

I'm really hoping that functional languages will evolve in a way that they become more readable at a glance.

Haskell is very clean and readable. The problem, however, is that its such a departure from imperative languages that you can't bring much of anything you already know over to it. You really do have to forget everything you're learned about programming and start from scratch. Until then, its all alien. That being said, I think that Haskell is the most clean looking of all the FP languages, but that's purely my opinio…

> The problem, however, is that its such a departure from imperative languages that you can't bring much of anything you already know over to it.

I don't find that really true; if you've used any structured language with static typing, there's a lot of carryover, especially if you've ever done any formal study of CS, since even when imperative languages are used functional patterns are pretty common.

The biggest problem I see is that there isn't a lot of pragmatic guidance on the bits that are unique to Haskell -- a lot of the documentation is very abstract, without a lot of guidance on solving specific real world problems. The power of Haskell is that you can make very general solutions in it quite easily; the weakness of the documentation of Haskell is that virtually all of it focusses on that highly general facilities and not enough on the kind of specifics that would help people get familiar with it while solving real problems.

Re: Scala founder: Language due for 'fundamental rethink'

#87
post #17

Earlier quoted context omitted.

Well -- they have the Python 3 disaster to learn from... you can't break backwards compatibility for minor gains -- if you are going to break it -- break everything you must and make the new thing much better -- half measures in this regard suck.

It's really absurd when people call Python 3 a "disaster". There was nothing disastrous about it. In fact, hindsight shows us that it was actually a very good path to take. Python 3 didn't negatively affect Python 2 or earlier users. Their code still runs fine, and is well supported by a huge number of libraries. They weren't forced into upgrading against their will at any point. Python 3 allowed the Python developer…

> Not only is Perl 6 pretty much unusable in practice today

I don't think that's true anymore, and for some subset of people, hasn't been true for a while now. If you consider performance the big blocker, that's getting better all the time[1],and is close to being competitive with Perl 5 ins some areas.

[1]: http://jnthn.net/papers/2014-yapceu-performance.pdf -- Start at slide 76 for performance graphs

Re: Scala founder: Language due for 'fundamental rethink'

#88

Earlier quoted context omitted.

What's up with the UK? Scala is also becoming increasingly popular in banks in the UK (as I heard from trusted persons). CLOS, Smalltalk, and Objective C (before it was cool) were for a long time very popular on Wallstreet.

Supposedly, Haskell and F# are also big in UK banks. Wow.

For what it worth, this website ranks the popularity of some keywords in UK's IT job ads: http://www.itjobswatch.co.uk/ Bank jobs are a big part of UK's IT jobs.

There is a category "Programming Language", in which you can see Scala and Clojure has taken steam since 2010, even if interest in Clojure seems to have waned a bit this year (and now it trails COBOL or Delphi). Interestingly, the salary advertised for Scala and Clojure jobs are also larger than for the more popular programming languages.

Re: Scala founder: Language due for 'fundamental rethink'

#89
post #82
post #21

Earlier quoted context omitted.

So you don't use type classes in Haskell? Neither touch F# or OCaml. Nor CLOS in Lisps.

Correct me if I'm wrong, but isn't OO in OCaml frowned-upon, or at least not used frequently by seasoned programmers? Not an OCaml programmer myself, but I heard this multiple times. For example, in Real World OCaml [ https://realworldocaml.org/v1/en/html/objects.html ]), and I quote from Chapter 11: > You might wonder when to use objects in OCaml, which has a multitude of alternative mechanisms to express the simila…

The fact that OO is not used frequently in OCaml does not mean that it is useless. Objects in OCaml are typed structurally, not nominally, i.e. object's type is the set of the methods it provides.

Consider an example:

  let a = object method f x = 1 end;;
  val a :  int > =  
We define an object a, and the interpreter tells us that the type of the object is " int >", i.e. it provides method f.

Define another object

  let b = object method f x = 2; method g x = x end;;
  val b :  int; g : 'b -> 'b > =   
Define a function that takes calls method f of its argument:

  let f obj = obj#f ();;
  val f :  'a; .. > -> 'a = 
The type of the function tells us that its argument must be an object that provides method f, and maybe some other methods. Now, we can call this function with object a, and object b:

  f a;;
  - : int = 1  

  f b;;
  - : int = 2 
This structural typing, (or if I'm not mistaken, it's called row polymorphism) is an interesiting feature of the language, and it may be useful in some situations. It does not harm the rest of the language, and I see it as a good feature that probably does not get a lot of attention, but it's theoretically solid and works well. Compared to more usual OO systems, it is cleaner and, imho, easier to reason about.

That said, I think, the authors of "Real World OCaml" are right, encouraging the use of Modules rather than Objects. But they do so primarily because in many mainstream languages the main means of abstractions are objects, and they are used for everything. OCaml has functors, modules, it has records, it has ADTs, it has functions, so the need for objects is very limited, and so the new users must get this message very clearly.

An article on objects in OCaml: http://roscidus.com/blog/blog/2013/09/28/ocaml-objects/

Re: Scala founder: Language due for 'fundamental rethink'

#90

What a confused interview. If the audience is for people who are interested in knowing scala's timeline then saying "isnt Java 8 functional now because it has lambdas" is either dumb or trying to be dumb on behalf of a java audience who doesnt care about the scala timeline.

I agree. It hardly sheds any light on what's really going on in the Scala community or why.
Post reply on HN