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

[Analyzer] Support nameless declarations #309

Open
Martinsos opened this issue Sep 24, 2021 · 2 comments
Open

[Analyzer] Support nameless declarations #309

Martinsos opened this issue Sep 24, 2021 · 2 comments

Comments

@Martinsos
Copy link
Member

Some declarations, like route or dependencies, don't need a name, there is no purpose in them being named.

Therefore, we should allow them being nameless:

route { path: "/", page: HomePage }

dependencies {=json
  mylib: "1.0.0"
json=}

Right now, this is not supported!

What do we need to support it?

  1. We need to modify Analyzer.Parser so it allows for declarations without a name (or maybe it already allows that? I don't think so).
  2. We need to modify Analyzer.Evaluator.Decl so it doesn't always expect a name to be associated with a declaration
  3. Something else? But I think things above are main places and the rest of the changes will stem from there.
@craigmc08
Copy link
Contributor

I thought we decided to remove nameless declarations from the new version? In #109 (comment)

route was given a name so you can't refer to non-existent routes, and we decided dependencies and auth to be part of app. It might be worth discussing this again though:

There are several things that don't make sense to have names: app, dependencies, auth, server, db. The reason is that it's invalid to have more than one, and there's no need to refer to them in a .wasp file. So it's worth considering how to design this to only allow one (nameless) instance of each of these.

The original idea for this implementation was to a have third statement type that's an unnamed decl (we didn't settle on a good name. inst for instance or maybe sing for singleton?). The type checking an evaluation would be identical to decl.

@Martinsos
Copy link
Member Author

@craigmc08 makes sense I forgot about that!
That is a good analysis -> let's keep it at this for now and we can revisit this in the future, this is certainly not urgent right now.
I think it will make sense at some point to have these nameless declarations, but as you said for now we can either just make them part of the app, and then we can figure it out as we go.

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

No branches or pull requests

2 participants