8 ms·
As a scala fan: Sequence literals, intersection types, type aliases, declaration-site variance, functions and methods? Got them. Modules? Meh. The OSGi thing
by lmm 13y ago
As a scala fan:
Sequence literals, intersection types, type aliases, declaration-site variance, functions and methods? Got them.
Modules? Meh. The OSGi thing has always struck me as hideously overengineered; I've never understood what problem it's supposed to solve.
Nullable types? The trouble with doing this at the language level is that you can't then treat them as plain old objects. Can I write a method that's polymorphicly nullable? Can I write a method that polymorphicly handles "nullable" or Future or Validation, like scalaz's "sequence"?
Union types? Yeah, proper union types would be good.
- jaxytee 13y agoYou beat me to this comment. Ceylon brings nothing new to the table that would make me jump the Scala ship. What's the point of having Nullables if we're still forced to do glorified if(*.isNull) ... else ... checks? I'd much rather use Scala's Option type that has Map and GetOrElse already baked in. Also, the tooling around Scala is starting to mature. The Kotlins and Ceylons of the world are way behind Scala in this regard as well.
- frowaway001 13y agoAnd it's not like one is stuck with Option either. I think the ability to choose which abstraction is the best for a specific use case (Option, Either, Validation, Future, etc.) is the major benefit over languages which just bake the handling into the language. Sure, those languages could just ship with additional classes which did that, but the problem is that they wouldn't be able to use the syntax sugar which is built-in for the special case of nulls as well as other language constructs like Scala's for-comprehensions which work for all types of a certain shape, not a single, built-in special-cased item.
- gavinking 13y agoAgain, nullable types are not "baked into" the language. They are syntax sugar for a union type. Also, Ceylon doesn't need Either, since that is just a workaround for not having union types. Seriously, union and intersection types are _really_ fundamental notions in set/type theory, and having them as basic constructs of the language makes the language _much_ more expressive. I seriously urge you to try it out. You'll love them, I guarantee it.
- frowaway001 13y ago> Again, nullable types are not "baked into" the language. They are syntax sugar for a union type. So I can have my own type standing in for the ? instead of Null? String? // Option[String] ... String? // Validation[String]
- RivieraKid 13y ago"String?" is equivalent to "String|Null". Only the question mark syntax sugar is baked in.
- gavinking 13y ago> What's the point of having Nullables if we're still forced to do glorified if(*.isNull) ... else ... checks? I'd much rather use Scala's Option type that has Map and GetOrElse already baked in. Sorry, but Option is just not better. One advantage of using a union type is that if I have a List<String?>, I just have a List<String|Null> (which maps to a plain List<String> at the JVM level) not a whole list of wrapper objects in a List<Option<String>>. And of course Ceylon has sufficient syntax sugar so that you can write things like: print(nameOrNull else "Gavin); You definitely don't have to do an "if (exists...)" every time you encounter a null value. > Also, the tooling around Scala is starting to mature. The Kotlins and Ceylons of the world are way behind Scala in this regard as well. WDYM?! I strongly beg to differ. Have you seriously tried out Ceylon's IDE? Or are you just speculating?
- frowaway001 13y ago> I strongly beg to differ. Have you seriously tried out Ceylon's IDE? Or are you just speculating? He was probably just reading your own mailing list. Why speculate, if he can get the state of tooling right from the core developers? :-)
- gavinking 13y agoHeh, we'll have to post more commercials about how great we are, instead of always being so intensely self-critical ;-)
- lukaseder 13y agoI would agree to that. Given the excellent IDE support that is provided from the first release on, you have some killer platform there, quality-wise.
- gavinking 13y ago> Modules? Meh. The OSGi thing has always struck me as hideously overengineered And that's _exactly_ why you need modularity built into the ecosystem. OSGi and Maven _are_ hideously overengineered, and they're overengineered because there's no common model built into the language, toolset, and platform. > I've never understood what problem it's supposed to solve. Management of versioned dependencies between libraries and components developed by different teams. This is absolutely central to what software engineering is all about. > Nullable types? The trouble with doing this at the language level is that you can't then treat them as plain old objects. I don't think you've understood what this is. In Ceylon, null is the singleton instance of the perfectly ordinary class Null. A nullable type is just a union type of form Null|X, for any type X. > Can I write a method that's polymorphicly nullable? Sure. You should see the crazily cool stuff we can do with stuff like the signature of max(). You'll be impressed, I promise! After that, check out signatures of operations like Set.union(), Set.intersection(), coalesce(), compose(), flatten(), curry(), etc, to see a bunch of other things you just can't write in Scala. > functions and methods? Got them. Does scala have toplevel functions? I thought they always had to be nested inside some object? But my real big problem with Scala here is it just doesn't have proper function and tuple types that you can abstract over. Instead you have F, F1, F2, F3 ... F22 and Tuple2, Tuple3, ... Tuple22. That to me is just rubbish.
- barkmadley 13y ago> > Can I write a method that's polymorphicly nullable? > Sure. You should see the crazily cool stuff we can do with stuff like the signature of max(). You'll be impressed, I promise! From the docs: > A nonempty iterable is an iterable object which always produces at least one value. A nonempty iterabe type is written {String+}. Distingushing nonempty streams of values lets us correctly express the type of functions like max(): > {Float+} oneOrMore = .... ; > {Float*} zeroOrMore = .... ; > Float maxOfOneOrMore = max(oneOrMore); //never null > Float? maxOfZeroOrMore = max(zeroOrMore); //might be null While this is interesting, is it enforced by the compiler? i.e. is the following a runtime, or compile time error?: Float maxOfOneOrMore = max(zeroOrMore);
- gavinking 13y ago