I propose creating a new internal package to provide often used low level
string conversion methods within the go std lib.
Within the go code base many different versions of common string conversion
functions such as itoa are implemented.
With the mechanism of internal packages these could be consolidated into
one package.
An internal package that can be used in other std lib packages would be
beneficial from my point of view in many ways - e.g. for the itoa function:
1. reduce duplicated code (itoa/itod is/was implemented in os, syscall (2x)
,net, ... )
2. can provide tested versions without duplication of tests in each package
and unify existing tests
3. avoid errors made while reimplementing these functions (e.g. infinite
recursion on edge cases for itoa/uitoa)
4. standardize naming of functions (e.g. uitoa vs itod)
5. no confusion over what signature itoa has in each package and what cases
it can handle or not handle correctly (e.g. when a specific itoa does not
handle negative integers)
6. apply bug fixes and optimizations (even if not performance critical) to
all use cases of the functions in the code base by patching them in one
place
- Martin Möhrmann
--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.