Hacker News new | ask | show | jobs
by lmm 4908 days ago
>Nice. I wonder how they implemented this. And I'll keep wondering because I can't find a link to the source code. Maybe there is a link to it, maybe not. We're talking about Oracle so without knowing better, I'll assume there is not ...

If you were using Java the way people do in the real world, from your IDE, you'd already be looking at the source code.

>What the fuh is a "sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A, List] with LinearSeqOptimized[A, List[A]]"

It's an abstract class (generic, and covariant in that generic parameter) that implements some interfaces. It's not hard.

>Reading further, I see section in the documentation called "Shadowed Implict Value Members". Wow, I have no idea what that is.

Take it one word at a time, it's pretty easy. Value - a value. Member - a member of the class. Shadowed - perhaps a scala-specific term, but it means it's in some parent class but hidden because it's also defined in this class. Implicit may be a new and scary concept, but it's pretty core to scala; if you use the language you get familiar with it pretty quickly.

1 comments

Right, you know exactly where everything is when it's your own messy room, but if an outsider wanders in, he can't tell the bed from the curtains.

I grant that there is sometimes a necessary tradeoff between power/abstraction and readability, but readability is still extremely important, and you can't just handwave away confusing language constructs and documentation with "it's obvious after you code in the language for a couple years". Simplicity and intuitiveness are powerful features in themselves.

I don't think we're not talking a couple of years, more like weeks or days.

How many actually new concepts are there? "sealed" (very simple, but ok it doesn't exist in other languages), "+A" for covariance (genuinely new, but you can ignore it until you want to use it). "with" for multiple inheritance I guess is new, but it works the same as "extends" inheritance (you might have questions about how it handles diamonds, but there aren't any here). Values and members should be familiar, as should the concept of shadowing if not the name (but there's not really a standard term for it).

Implicits are genuinely new, and genuinely complicate the code; I think of them the same way I think of lisp macros (they're too powerful, they're too easy to make the code incomprehensible with - but they enable things that we can't live without, and that we haven't found a safe way of allowing yet). But even then, the concept is very simple and easy to understand.

A big block of text with lots of unfamiliar words in is intimidating, but I don't think it's truly confusing or unreadable if you just take your time and actually try and read it.