Closed hollowaykeanho closed 1 year ago
Implemented FormatBOOL
bool
-> string
feature
Implemented FormatINT{N}
int{N}
-> string
feature
Implemented FormatUINT{N}
uint{N}
-> string
feature
Implemented FormatFLOAT32
float32
-> string
function with base conversion capability.
Implemented FormatPOINTER
&pointer
-> string
function.
Implemented FormatFLOAT64
float64
-> string
function with base conversion capability.
Implemented S64_ParseFLOAT64
string
-> float64
function with base learning capability.
Implemented S32_ParseFLOAT32
string
-> float32
function with base learning capability.
Implemented SN_ParseUINT
string
-> uint64
function with base learning and bit resizing capability.
Implemented SN_ParseINT
string
-> int64
function with base learning and bit resizing capability.
Implemented SN_Atoi
string
-> int64
function with base learning and bit resizing capability.
Implemented M64_Format
string
formatting function similar to fmt.Sprintf
function but without using reflection. This allows stable operations on TinyGo side.
Description
The current Go's
Sprintf
infmt
package is using a reflective for data type identification. This is not useful for Hestia library as we DO NOT want to base a human formatting function on a Go's niche runtime feature that is near impossible to implement across other programming languages. Hence, we have to supply our own string formatting function inhestiaINTERNAL
package, maybehestiaINTERNAL/hestiaFMT
package.This new package is required mainly to resolve the cycle-import problem across all packages where we do not want to happen at all.
This is only seen in Go and TinyGo programming languages. Rust does not have such issue and is offering
format!()
macro that does the work nicely.As long as the function can process primitive data types (e.g.
[]byte
,[]rune
,string
,uintX
,intX
,floatX
, andbool
), they are good enough already.Expected Behavior
Hestia packages use
hestiaINTERNAL/hestiaFMT
to process string internally across all its packages.Current Absent Behavior
HestiaGO cannot format internal string with primitive data conversion without depending on reflective
fmt.Sprintf
function from standard library.Attachment