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

Generated file/module names inconsistency? #36

Open
wclr opened this issue Oct 14, 2024 · 2 comments
Open

Generated file/module names inconsistency? #36

wclr opened this issue Oct 14, 2024 · 2 comments

Comments

@wclr
Copy link

wclr commented Oct 14, 2024

Currently, for:

  • file Shapes.proto with package named interproc
  • we get purs file Shapes.Interproc.purs with module name Interproc.Shapes

Was it intended to be this way?

@wclr wclr changed the title Generated names inconsistency? Generated file/module names inconsistency? Oct 14, 2024
@jamesdbrock
Copy link
Member

jamesdbrock commented Oct 15, 2024

Yes it was intended this way. Maybe there is a better way.

  1. For each *.proto file we generate one *.purs file.
  2. I like Shapes.proto and Shapes.Interproc.purs to be close to each other in alphabetical order for file browsing.
  3. protoc allows multiple files to have the same package name, but PureScript requires each file to have a different module name.

-- 2. protoc allows multiple files to have the same package name,
-- such as descriptor.proto and any.proto (package "google.protobuf")
-- but Purescript requires each file to have a different module name.

So each generated Shapes.Interproc.purs file includes both the original file name and the protoc package name so that the generated file name is distinct, and the generated file name is the same as the PureScript module name.

@wclr
Copy link
Author

wclr commented Oct 15, 2024

I like Shapes.proto and Shapes.Interproc.purs to be close to each other in alphabetical order for file browsing.

I currently put proto files in a separate folder, and generated files into the src, also I usually have files sorted by extension files first in IDE exlorer.

Anyway, to me it just seems kinda strange to see file Shapes.Interproc.purs with module Interproc.Shapes inside.
I believe you also prefer to use small caps so purs file is called shapes.Interproc.purs.

I'm not sure how to make it better, I just pointed to this confusing moment in naming.

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