3 ms·
> in e.g. Scala, "5 + 6" is just calling the "+" method on 5 What's calling? What's a method? What's 5 that lets me "call" "methods" on it? Yeah, absolutely n
by merijnv 12y ago
> in e.g. Scala, "5 + 6" is just calling the "+" method on 5
What's calling? What's a method? What's 5 that lets me "call" "methods" on it?
Yeah, absolutely nothing intimidating for a 10 year old there...
- lmm 12y ago> What's calling? What's a method? No different or harder than calling a function in Haskell. > What's 5 that lets me "call" "methods" on it? A value like any other. That's how you do everything in Scala - calling methods on values. Again, I don't see how you could reasonably claim this is any more intimidating or confusing than calling a function in Haskell. > Yeah, absolutely nothing intimidating for a 10 year old there... I didn't say that; just that it's less intimidating than Haskell. It doesn't introduce confusing abstraction immediately like Haskell does. In Scala, 5 is an Int, you can click through to what an Int is and see that it has a + method on it. "Hello" is a String, you can click through to what a String is and see that it has a startsWith method on it. In Haskell, "+" comes from a mysterious faraway place and you can see that it's "a :: Num => a -> a -> a". I do think this involves not just more symbols but genuinely more abstract concepts than the Scala version.