ceylon / ceylon-js

DEPRECATED
Apache License 2.0
54 stars 9 forks source link

Check that latest change to `native` is persisted correctly to the model #661

Closed quintesse closed 9 years ago

quintesse commented 9 years ago

Enrique, I made a change yesterday that allows native annotations to have a variadic list of backend names (just like by for example). Nothing seems to break but could you please check that this information gets persisted correctly to your model? (This to prevent having to make backward incompatible changes in Ceylon 1.2.1 or 1.3 or whatever)

chochos commented 9 years ago

no it won't get persisted correctly to the model because native is one of the annotations that is packed into a bitmap, so when building the model from JSON, only the JS backend is set for the annotated declaration, but the annotation itself doesn't have any args.

chochos commented 9 years ago

Remember that supposedly this was enough because the JS model will only be used to compile to JS?

chochos commented 9 years ago

I suppose I can remove native from the bitmap annotations to store it as a regular one with its args.

quintesse commented 9 years ago

You asked if this was important and I think it is, otherwise we release this week and the next day we'll have a version that's not backward compatible anymore with what we released. So hoping that the change is small enough I'd prefer to do it now.

chochos commented 9 years ago

ok then

FroMage commented 9 years ago

Err, I added it to the metamodel yesterday man ;)

FroMage commented 9 years ago

$mod-nat and stuff.

quintesse commented 9 years ago

Err, I added it to the metamodel yesterday man ;)

For all declarations?

chochos commented 9 years ago

can't find any occurrences of $mod-nat anywhere. But the native annotation is packed in a bitmap along with shared, formal, actual, etc so it doesn't store any arguments. I'm working on this (just unpacking it and checking that it gets restored properly)

quintesse commented 9 years ago

can't find any occurrences of $mod-nat anywhere

You can't? It's here: https://github.com/ceylon/ceylon-js/commit/8bb46f110a5592319398ef1800fe3b1b9dda2586

chochos commented 9 years ago

ah, I was looking in the js code.

chochos commented 9 years ago

So, I unpackaged the native annotation and now it gets stored, without any args, because the one that gets stored is the one from the header, not the implementations. This is in the compile-time model.

The metamodel however does contain the native annotation with the arguments.

quintesse commented 9 years ago

Ok, the idea is that when we get a working Dart backend it could be possible that we'd have code that both for JS and for Dart because they happen to have the same implementation. So you'd perhaps see things like:

native("js", "dart") shared String fooBar() { ... }

We'd have to be able to tell from the model that this method can be used by both backends, while a js-only method would given an error for Dart and vice versa a dart-only one would give an error for JS.

That might not actually work yet today, but I just want to make sure that when we make it work we only have to make changes to code not to any file formats. So if you think that's okay now we can close this.

chochos commented 9 years ago

OK let me push this stuff and close.

chochos commented 9 years ago

I also left the code that unpacks the native if it's in the bitmap, for the modules that still use that.

FroMage commented 9 years ago

Just don't remove what I out there because it's used by herd ;)

FroMage commented 9 years ago

s/out/put/

chochos commented 9 years ago

yeah I won't touch that