-
Notifications
You must be signed in to change notification settings - Fork 62
implement singleton constructors #2176
Comments
[@tombentley] Pushed some initial support for this to the
But there should be enough to play with. |
[@gavinking] Awesome! Singleton constructors should eventually support delegation to partial constructors. But we don't need to support that until we have time to implement it. The typechecker doesn't yet support it. So let's get the rest working first! |
[@gavinking] class MyPoint {
shared Float x;
shared Float y;
shared new origin {
x = 0.0;
y = 0.0;
}
string => "(``x``, ``y``)";
}
void runWithPoint() {
print(MyPoint.origin);
} Gives me:
|
[@tombentley] Should be fixed now. |
[@gavinking] Cool, thanks, let's see. |
[@tombentley] I think I'm done on this for now (until such time as we actually decide to merge this stuff). At which point:
|
[@gavinking] class Point {
shared Float x;
shared Float y;
shared new origin {
x = 0.0;
y = 0.0;
} It passes the typechecker, but the backend gives me:
|
[@gavinking] On the command line I get:
|
[@tombentley] You pulled the spec_Whatever_ branch of ceylon.language and rebuilt everything? |
[@gavinking] aaah you have a branch of |
[@tombentley] I told you that, though admittedly not here on the issue. |
[@gavinking] class Bool {
shared new true {}
shared new false {}
} Results in:
Renaming to |
[@gavinking] Also: import calendar {
Bool {
t=true_,
f=false_
}
}
Bool bt = t; Results in:
|
[@gavinking] @tombentley finally, static refs to singleton constructors of member classes, for example, |
[@sgalles] I'm not sure, does this belong to this issue ? import foo{
Foo {bar}
}
class Foo{
shared new bar{}
}
shared void run(){
Foo f = bar;
print(f);
}
Or should I open two issues ? |
[@FroMage] Yes please. This issue is about something which is merged no ? Why is it 1.3 then? |
[@FroMage] @tombentley have the last comments reported by @gavinking been fixed already or not? If yes then why is this issue still open? |
[@tombentley] I don't think they have, yet. I'll do those next. |
[@FroMage] Oh, OK thanks. |
[@tombentley] This is now done. |
…tructors for singleton constructors; not generating fields or getters yet.
… ctors in value expressions, which means "switch" just works.
…local classes, which turned out quite messy because I need to eagerly instantiate each instance after the decl of the local class. We didn't seem to have a way of doing that before, so I renamed ClassDefinitionBuilder.also() to before() (since add prepended arbitrary trees before the class) and added an after().
…annotations to singleton constructors (and fix a omission to do with constructors annotated incorrectly).
…applying annotations to singleton constructors,
[@gavinking] Whenever you guys feel like it, it should be easy to implement support for #4235.
[Migrated from ceylon/ceylon-compiler#2176]
[Closed at 2015-08-19 08:54:31]
The text was updated successfully, but these errors were encountered: