Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supported backends annotation #946

Closed
loicrouchon opened this issue Mar 5, 2014 · 13 comments
Closed

Supported backends annotation #946

loicrouchon opened this issue Mar 5, 2014 · 13 comments
Assignees
Milestone

Comments

@loicrouchon
Copy link
Member

We need a backend annotation that can be applied on a Module.
If this annotation is not provided, then, all backends would be considered as supported.

This will be useful for tools like ceylon.build to discover modules for JVM / JS backends.
It could also be used in the compiler to throw an error in case your trying to compile for a backend which is not supported.

@gavinking
Copy link
Member

Sure. But I thought there was already an issue proposing this...?

@gavinking gavinking added this to the 1.1 milestone Mar 5, 2014
@loicrouchon
Copy link
Member Author

#327 was mentioning it but it has been closed and split into #499 and #500 that doesn't mention this feature.

@lucaswerkmeister
Copy link
Member

With this, #969 / ceylon/ceylon-compiler#1648 could be fixed in the typechecker.

@gavinking gavinking modified the milestones: 1.2, 1.1 Jul 25, 2014
@gavinking gavinking modified the milestones: 1.2, 1.3 Apr 27, 2015
@gavinking
Copy link
Member

@quintesse isn't this part of what you're working on with the new native stuff?

@quintesse
Copy link
Member

It would have to be part of it when implementing it fully, yes, mostly for #499 while for now I was handling #500 first.

What would the annotation be? A new one like suggested here (backend) or do we repurpose native for this? The only potential problem I see with the latter is if we ever support more than 2 backends we'd either have to let you write native("jvm,js") or change the restrictions on the annotation to allow more than one.

@gavinking
Copy link
Member

I would reuse native, yes.

@quintesse
Copy link
Member

I'm wondering about something here. What is this annotation supposed to do actually? It seems okay as an indication, but you can't really trust it can, you? I mean, you could easily write a module that was backend dependent and not use this annotation. So the absence of this annotation would not guarantee that the module can be used by all backends. Without that guarantee it seems to lose much of its value, right?

@luolong
Copy link
Member

luolong commented Apr 29, 2015

Well, @gavinking suggested at one point that it's native platform availability is an attribute of a module. So, typechecker could (in theory) validate that the imported module indeed supports the the platform it is marked for.

@quintesse
Copy link
Member

Well I'm not so sure it could validate it, except perhaps to check that you're not lying (saying your code is for the JVM backend when it's obviously for the JS backend). But I don't think it can actually strictly check it (otherwise we could just generate the required information, right?).
And if we can't strictly trust that annotation (the developer just forgot to put it there) then we're back to checking the repository for the existence of CAR/JAR vs JS artifacts for the real answer.
So I still wonder what the usefulness is of this annotation.

@gavinking
Copy link
Member

@quintesse there were two things we came up with for this:

  1. To indicate which modules are platform-specific in a large project like ceylon-sdk with multiple modules.
  2. To avoid the need to annotate the module import native in every place the module is used.

@quintesse
Copy link
Member

@gavinking ok, understood, so we simply say that each compiler backend will refuse to compile a module annotated native for a different backend.
That seems easy enough.
If you don't mind I'd still like to at least add the possibility to add a native annotation on imports for those cases where the module wasn't annotated.

@gavinking
Copy link
Member

If you don't mind I'd still like to at least add the possibility to add a native annotation on imports for those cases where the module wasn't annotated.

Well my problem with all this is that there's currently no validation at all that if some declaration is backend-specific, then it is only used from within other declarations specific to that same backend.

So basically, as this functionality exists today, annotating a module import with native would do essentially nothing useful, since you don't actually make any use of this information.

quintesse added a commit to ceylon/ceylon.language that referenced this issue May 8, 2015
quintesse added a commit to ceylon/ceylon-compiler that referenced this issue May 20, 2015
quintesse added a commit to ceylon/ceylon-compiler that referenced this issue May 20, 2015
quintesse added a commit to ceylon/ceylon-js that referenced this issue May 20, 2015
quintesse added a commit to ceylon/ceylon-js that referenced this issue May 20, 2015
quintesse added a commit to ceylon/ceylon-js that referenced this issue May 20, 2015
quintesse added a commit to eclipse-archived/ceylon-sdk that referenced this issue May 20, 2015
quintesse added a commit that referenced this issue May 21, 2015
quintesse added a commit to eclipse-archived/ceylon-sdk that referenced this issue May 21, 2015
quintesse added a commit to ceylon/ceylon-compiler that referenced this issue May 21, 2015
quintesse added a commit to ceylon/ceylon-compiler that referenced this issue May 21, 2015
quintesse added a commit to ceylon/ceylon.language that referenced this issue May 21, 2015
@quintesse
Copy link
Member

I'll close this now because this is now implemented as described in the issue at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants