TBD54566975 / ftl

FTL - Towards a 𝝺-calculus for large-scale systems
https://tbd54566975.github.io/ftl/
Apache License 2.0
23 stars 7 forks source link

Should we normalize casing for decl names and type names? #3146

Open wesbillman opened 3 weeks ago

wesbillman commented 3 weeks ago

Some examples:

We've seen a couple bugs lately specifically with typealias/typeAlias that are a bit tricky to track down. Maybe we need some normalizeX functions to keep things consistent?

alecthomas commented 3 weeks ago

We're supposed to be using lowerCamelCase everywhere for values and UpperCamelCase everywhere for types.

alecthomas commented 3 weeks ago

It would be good to have explicit named functions for this though, as opposed to us implicitly using strcase.ToLowerCamel() et al

alecthomas commented 3 weeks ago

Caveat to this is that for non-FTL names we should use whatever the casing is for that system. eg. for JSON REST API's we should use whatever the most common naming convention for JSON is. FTR Proto's JSON encoding uses lowerCamel.

wesbillman commented 3 weeks ago

It would be good to have explicit named functions for this though, as opposed to us implicitly using strcase.ToLowerCamel() et al

Yeah that's the spirit of this ticket for the console side. We currently have quite a few toLower() calls in the ts code, which I would prefer to have a noralizeDecl or something to keep things consistent. So the ftl side is consistent with like getEcho, but console isn't so much.

It's also a bit brittle on the console because a url with typealias will fail, where typeAlias would succeed so we just need to be a bit more tolerant there I think.

alecthomas commented 3 weeks ago

Aha! I see, I thought you were referring to the backend, where it's also true.