purescript-protobuf icon indicating copy to clipboard operation
purescript-protobuf copied to clipboard

Generated file/module names inconsistency?

Open wclr opened this issue 1 year ago • 2 comments

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 avatar Oct 14 '24 17:10 wclr

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.

https://github.com/rowtype-yoga/purescript-protobuf/blob/dbe4d5039b8bd73b72936d22aba483ab642dfc5a/plugin/ProtocPlugin/Main.purs#L158-L160

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.

jamesdbrock avatar Oct 15 '24 05:10 jamesdbrock

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.

wclr avatar Oct 15 '24 06:10 wclr