Re:Red Hat's top secret Java Killer/Successor: The Ceylon Pr...
by fleitz on Wednesday April 13, 2011 @03:15AM
(#2441129)
Constructors are stupid and violate one of the principle ideas behind OO which is separation of concerns.
What initializes a data structure should not care how the data structure was allocated. It's two functions one () -> T and T -> T allow them to be first class citizens.
If you want to combine them use a static method that simply invokes the initializer after the allocator (which is how it works anyway, and how new is implemented in both Ruby and Obj-C). And it's not like it solves any real problems as it's perfectly alright to have uninitialized and incorrectly initialized objects with current constructors.
Re:Red Hat's top secret Java Killer/Successor: The Ceylon Pr...
by jbellis on Wednesday April 13, 2011 @12:49AM
(#2440807)
TFA suggests "local c = Counter()" is what you are looking for.
Re:Red Hat's top secret Java Killer/Successor: The Ceylon Pr...
by jacques_chester on Wednesday April 13, 2011 @01:01AM
(#2440840)
You're right.
Assignment using := and string concatenation using adjacency aren't particularly new.
</curmudgeon>
edit -- further looking through the presentations ...
They seem to have ditched the 'new' keyword, but not gone as far as having inferred typing which is a pity.
would be better as (edit: ignore this, the local keyword apparently triggers type inference).:= and = are used to distinguish between assignment to mutable and immutable variables. Is this necessary?
Clever use of syntactic sugar gives it a Lua-like flavour for programmatic generation of markup / UIs.
Use of & and | symbols gives a clever way to assemble interfaces.
When an object "satisfies" (ie "implements") interfaces, it can combine them either as intersections (&) or unions (|) of multiple interfaces.
A few nice features imported from functional programming land include algebraic types and type-safe switches.
A lot of attention paid to the covariance/contravariance tarpit.