truck icon indicating copy to clipboard operation
truck copied to clipboard

Canonical `struct` naming

Open virtualritz opened this issue 3 years ago • 5 comments

See Rust API naming guidelines.

In UpperCamelCase, acronyms and contractions of compound words count as one word: use Uuid rather than UUID, Usize rather than USize or Stdin rather than StdIn.

For example in stl.rs:

STLFace -> StlFace STLReader -> StlReader

STLType -> StlType STLType::ASCII -> StlType::Ascii

etc.

Would you consider a PR with such changes if I opened one?

virtualritz avatar Feb 20 '23 12:02 virtualritz

Thank you for your issue.

If there is something official as evidence, we will try to follow it. It would be helpful if you could give me a pull request.

We would like to specify in advance. For single letter + complete word combinations, we will consider the first letter and the complete word as separate words. Official Rust APIs include, for example, BTreeMap. For example, in truck,

  • Use BSplineHoge rather than BsplineHoge.
  • Use PCurve rather than Pcurve.

ytanimura avatar Feb 21 '23 11:02 ytanimura

Another thing I noted is the naming of composite structs. I.e. usually the type of geometry the struct holds is at the end of the name. For example: NurbsSurface. It holds a surface.

But RevolutedCurve also holds a surface. So it should be named RevolutedSurface or RevolutedCurveSurface? Or am I missing something?

virtualritz avatar Feb 23 '23 20:02 virtualritz

Well, that's what I was struggling with too. What is being rotated here is a curve, not a surface, and a RevolutedSurface should point to S^2xS^1 in R^4, for example. However, SurfaceOfRevolution seems a bit old-fashioned as a class name.. I wish there was some more natural way to describe it.

ytanimura avatar Feb 24 '23 06:02 ytanimura

[...] I still think is_curve_included is a bit ungrammatical. If I had to say, is_including? [...]

The word including is not used in this context much in English at all. Most CAD apps I used have a concept of "a curve on surface".

Maybe you can clarify first what this predicate tests and then we can better ponder a good name? I assumed it returns true only if the curve is whitin the 2D domain of the surface? But now I can't find the method any more after the latest pull. Was it renamed or removed?

virtualritz avatar Mar 06 '23 15:03 virtualritz

On that note. I saw is_geometric_consistent(). I think this should be is_geometrically_consistent or maybe it could be abbreviated to is_geo_consistent()?

I.e. there is the geometric consistency and if that is true then the resp. shape is geometrically consistent.

virtualritz avatar Mar 06 '23 15:03 virtualritz