Closed quintesse closed 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.
Remember that supposedly this was enough because the JS model will only be used to compile to JS?
I suppose I can remove native
from the bitmap annotations to store it as a regular one with its args.
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.
ok then
Err, I added it to the metamodel yesterday man ;)
$mod-nat
and stuff.
Err, I added it to the metamodel yesterday man ;)
For all declarations?
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)
can't find any occurrences of $mod-nat anywhere
You can't? It's here: https://github.com/ceylon/ceylon-js/commit/8bb46f110a5592319398ef1800fe3b1b9dda2586
ah, I was looking in the js code.
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.
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.
OK let me push this stuff and close.
I also left the code that unpacks the native
if it's in the bitmap, for the modules that still use that.
Just don't remove what I out there because it's used by herd ;)
s/out/put/
yeah I won't touch that
Enrique, I made a change yesterday that allows
native
annotations to have a variadic list of backend names (just likeby
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)