Replace as keyword with @as builtin function for type conversion #35
Loading…
Reference in a new issue
No description provided.
Delete branch "as-builtin-fn"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
askeyword with@asbuiltin function for type conversion@ -24,0 +63,4 @@| `uint` | `byte[]`, `int`, `float`, `str` || `float` | `byte[]`, `int`, `uint`, `str` || `str` | `char[]`, `byte[]` || struct | `str` |I think we should show examples/declare how some of the more complex types are converted to str. For example,
struct,map,enum, andarray. Thoughboolcould probably be thrown in as well (is ittrue|falseor0|1?). I'd saytrue|false, but that should be explicit.A similar issue with enums:
What shape are we printing here as a str? Do we include the value inside it, the signature only, how do we handle nested Enums, etc.
I've added examples for how each type will be printed, though all of them are subject to change. I think in actual implementation, we should have a
std/fmtmodule that declares aninterface Formatthat something likefmt.printlncould use, kind of a mix between Rust'sstd::fmt::Displayand Go'sfmt.Println.where
This could be the recommended way to do formatted printing, and
@printlnis available as the default.