| > Nobody needs or wants the mess of Java-style initialization Ceylon tries to replicate. Initialization in Ceylon is nothing like initialization in Java: - For the simple (common) case where there is exactly one initialization path, Ceylon is far less verbose. - In Ceylon, the compiler guarantees that ever field not marked variable is assigned exactly once. > Yet another static thing in class declarations? Not really, just a constructor with no parameters. Constructors are not "static". Constructors access the members of the class. > Constructors in Scala are intended to directly initialize fields. But it seems to me that they can't. Isn't it correct that only the primary constructor can initialize vals? > Constructors in Scala are intended to directly initialize fields. They shouldn't be called directly, and are often private. AFAICT it is not a limitation of the Scala language that constructors shouldn't be called directly. If it's indeed a practice that constructors aren't called directly, then it's interesting to enquire why that might be. And indeed an answer presents itself: because they don't have names. > Factory methods provide everything else, and are declared in objects, instead of being static like in Ceylon. Wait: a factory method declared on a "companion object" is not like static?! Really? And it seems to me that people probably hide constructors behind factory methods precisely because constructors in Scala don't have names. I mean AFAICT, the syntax for calling a factory method of a companion object in scala is exactly the same as the syntax for calling a constructor in Ceylon! You just have to go through a whole lot more ceremony in Scala. > Scala did away with 90% of the mess associated with constructors And, AFAICT, also lost like 75% of their capabilities. Unless my evaluation above is wrong, and I'm missing something. But so far no-one has spoken up to correct me. > therefore have a nice day! :-) You too! |