Hacker News new | ask | show | jobs
by gavinking 4022 days ago
> fact is that constructors are called on the class/type, and not on the instance.

But this is the case in Scala too. So I really don't understand the distinction you're trying to make.

> No, because it is good design to have one entry-point to create an instance, not 5.

I don't understand how having a factory method on a Scala companion object that calls an overloaded constructor of a Scala class is not a separate "entry-point". I count each of those factory-method-constructor bundles as one entry-point. And even if these factory methods all call the same constructor, they still seem like separate "entry-point"s.

And apart from your assertion that a single "entry-point" is good design, I don't quite see any particular reason to believe it. You've offered no arguments for this assertion.

> In Scala you have one place for "static" things. In Ceylon, static is all over the place:

Scala has members of objects and constructors of classes. Ceylon has members of objects and constructors of classes. Where is the difference? OK, so in Ceylon I can have a constructor which does not declare any parameters. How does that amount to being "all over the place" compared to Scala.

> Yes. Ceylon wasted the "good" syntax on the wrong construct. Most of the patterns leveraged in factory methods are just not available in Ceylon, because the best syntax was directly married to the class.

Well you see this is where Scala starts to look really bad. The problem is that Scala has no plain functions. Scala forces you to write methods of objects. In Ceylon we have toplevel functions, so we just don't need to go around sticking functions on the side of classes like you do in Scala.

> Everything Ceylon has built into "constructors" are just standard methods with no magic required in Scala.

This is simply false. You can't emulate constructors with plain methods in a language which enforces immutability / single-assignment. If you could, we would have done it that way.

> Yes, constructors are not extremely powerful – because they don't need to be in Scala.

Well, I never claimed that Scala needed constructors. Indeed I never mentioned Scala until people started trying to say—incorrectly to the point of absurdity, as it turns out—that Ceylon had copied its system of constructors from Scala.

Indeed you were one of those people. You entered this discussion with the following attack on me:

> A language designer which doesn't want to give credit where credit is due

I'm still waiting for you to retract that, now that I've conclusively demonstrated that Ceylon's constructors are totally different to—and more powerful than—Scala's.

1 comments

    A language designer which doesn't want to give credit
    where credit is due

  I'm still waiting for you to retract that, now that I've 
  conclusively demonstrated that Ceylon's constructors are 
  totally different to—and more powerful than—Scala's. 
Eh. What?

A) You conveniently left out the other part of the sentence.

B) I already commented on that topic very early on, and clarified:

  Ok ... I'm really starting to believe you when you said you 
  didn't look into that other language, because there is 
  practically no benefit in doing it the way Ceylon does.
To which you – confusingly – replied with:

  I never said that. Please don't put words into my mouth.
So what do you actually want?

  Ceylon's constructors are totally different to—and more 
  powerful than—Scala's
Yep. I didn't deny that. It's a good thing though, because Ceylon's approach isn't very good in terms of language complexity.
I never said I've never looked at Scala. I think you can tell from my responses to you in this thread that I'm in fact quite knowledgeable about Scala. What I said was that I had not looked closely at how Scala does constructors and that they were not an inspiration behind the design of constructors in Ceylon.

Whatever, your attack on me was totally uncivil and unjustified, as you now realize, which is why you're backpedalling it so furiously. You've never interacted with me before, and so coming in here with a blazing personal attack was completely unreasonable behavior. I think you see that, so let's just drop it now.

> Ceylon's approach isn't very good in terms of language complexity.

Here's another assertion for which you simply have not provided evidence. How are Ceylon's constructors more "complex" than Scala's constructors? The actual syntactic weight of both constructs is almost identical. And in terms of complexity, the factory-method-on-a-companion-class pattern is significantly more complex in terms of ceremony than doing the equivalent thing in Ceylon.

Look man, stepping back a second, I can see that you're clearly a fan of Scala and that Scala is something you love and enjoy. That's great! But Scala isn't perfect and other languages can have good ideas too. I highly recommend you spend some time learning Ceylon, since it has a bunch of awesome things in it that I know you'll love: the things we can do with union and intersection types, disjointness, abstraction over tuple and function types, etc, are just beautifully elegant and powerful. Don't let the fact that you love Scala blind you to other ideas.

  the things we can do with union and intersection types, 
  disjointness, abstraction over tuple and function types, 
  etc, are just beautifully elegant and powerful. Don't let 
  the fact that you love Scala blind you to other ideas.
I don't think it's a blind love, but all those things will ship in one of the next versions of Scala, too.

Given there are some things I can't just suffer anymore, like unreadable Generics (<>), required ; and "Type ident" syntax, maybe Ceylon just isn't for me. :-)

> I don't think it's a blind love, but all those things will ship in one of the next versions of Scala, too.

Well it's really lovely and encouraging to see Ceylon exercising such a strong influence on Scala. Makes me very proud.