Using strings does not include some necessary functions
larsrh opened this issue · comments
Invocation:
export_code String.implode checking Go
Error:
Generated_Code/exported.go:112:10: undefined: Go_private_fold_list
Generated_Code/exported.go:112:143: undefined: Go_private_map_list
This works, but looks less than ideal:
export_code String.implode go_private_map_list go_private_fold_list checking Go
ah yes, that one was always a hack 😅
the underlying problem is that the code printing rules for strings need to provide functions that have to use lists (literal_of_asciis
and asciis_of_literal
, which convert between lists of chars & actual strings). But Go has no built-in notion of a list we could use, so (unlike for other target languages) these code printing rules implicitly depend on the HOL list types also being exported.
Unfortunately afaict there is no good way to actually declare that dependency, nor to make sure that function names won't get renamed during code export (map
& fold
are pretty common names, and may need to be renamed in case of clashes). Hence this kind of workaround, which I'd intended to somehow find a cleaner solution for but never got around to it.