-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
proposal: Allow for primitives & fmt.Stringer in addition to string in templates #746
Comments
Looking at our proposal template I think we can answer some questions straight away: Backwards compatibility - This change should be completely backwards compatible, the generated code may be slightly different but shouldn't be breaking. There is also the question: Correctness over time - How can we reduce the risk of defects both now, and in future releases? But overall, I think that this proposal stands up to our requirements, it is just a case of whether moving from opaque string rendering to transparent (in some cases) is what we want. I think we can solve @a-h concern of displaying The reason the last one was closed is because we didn't get much engagement or discussion in the issue to form a consensus or even a majority. |
Per a short discussion on Discord with @joerdav . It might make sense to use a |
Discussion happened previous at #609 but focused on integers. I understand @a-h position on clarity around integers and currency. It seems like in the currency case having a
type Currency int64
with aString() string
function would allow it to be a validfmt.Stringer
and avoid ambiguity. Personally i'd like to see all primitive types andfmt.Stringer
accepted by the template. Since the code is generated you aren't paying the reflection cost each time.strconv
already has functions for Bool, Float, Int, etc. If you want to have more control, implement theStringer
interfaceThe text was updated successfully, but these errors were encountered: