Open dorian3343 opened 1 month ago
Most languages don't have Println builtin
Actually many do
I think we should follow this.
What will we get from this except the need to import? I personally never like the need to import fmt
in Go to make basic IO stuff.
BTW Go has builtin print
function (it's never used tho)
I think we should keep builtin as small as possible and packages more grouped. We should decide what package is for what and break off pieces into those packages.
I agree that some stuff could (and maybe should) be moved from builtin
somewhere else, but I'm not sure about Println
.
builtin
package currently serves 2 purposes:
Also, if there would be strong arguments for moving println out of builtin, then the question arise - should it be io
? Why not e.g. create fmt
like Go does? I believe there are other languages with this structure (e.g. Odin)
Also, if there would be strong arguments for moving println out of builtin, then the question arise - should it be
io
? Why not e.g. createfmt
like Go does? I believe there are other languages with this structure (e.g. Odin)
builtin.go
actually has a println
also. These builtins are meant for simple printing/debugging and the others under fmt
have error handling and more sophisticated things happening.
// implementation-specific way and writes the result to standard error.
// Print is useful for bootstrapping and debugging; it is not guaranteed
// to stay in the language.
func print(args ...Type)
// The println built-in function formats its arguments in an
// implementation-specific way and writes the result to standard error.
// Spaces are always added between arguments and a newline is appended.
// Println is useful for bootstrapping and debugging; it is not guaranteed
// to stay in the language.
func println(args ...Type)
Maybe this would be a good approach?
Most languages don't have
Println
builtin (with the notable exception being rust). The rest have them in an Io / Console or other package. I think we should follow this.