News for hackers. Stuff that matters.
Re:LLVM 7.0.0 released by simias on Wednesday September 19, 2018 @12:59PM (#18025663)
>This is all implemented in userland in the standard library. Last time I checked, in Rust the equivalent code is implemented with a macro hard coded in the compiler.

You're right and it's still the case as far as I know but I was thinking more about having a customized output, in Rust you can implement the Display interface and completely customize the way the object is serialized for output.

Your sibling comment by AnIdiotOnTheNet shows how to do just that but is it done purely in stdlib or is it actually implementable in the language itself? If it is actually doable in pure Zig I'd recommend showcasing that as part of the "generics" docs because as it is it's a bit odd to have example code that ends up exhaustively matching possible types, it kinds of defeat the purpose of generics and is the cause of my confusion.

Thank you for your answers by the way, they're appreciated. I'm very happy to see all this experimentation around low level "light runtime" languages lately, it's definitely sorely needed. I hope that 20 years from now C won't still be the alpha and omega of low level code.

Re:LLVM 7.0.0 released by AnIdiotOnTheNet on Wednesday September 19, 2018 @01:14PM (#18025790)
The standard lib has no special privileges, it's written entirely using the same language features available to everyone.

There are probably 2 reasons the documentation uses a simplified example:

1) the ability to introspect a type for the presence of a field or definition before attempting to use it is relatively new

2) the actual implementation of fmt.format is rather long and involved

Re:LLVM 7.0.0 released by CUViper on Wednesday September 19, 2018 @03:49PM (#18027161)
> The standard lib has no special privileges, it's written entirely using the same language features available to everyone.

Sort of -- it uses a lot of unstable features that are only available to outsiders with the nightly compiler.

Re:LLVM 7.0.0 released by steveklabnik on Wednesday September 19, 2018 @03:54PM (#18027190)
Your parent is talking about Zig, not Rust, I believe.
Re:LLVM 7.0.0 released by CUViper on Wednesday September 19, 2018 @04:31PM (#18027464)
Ah, ok. I suppose that's still a useful thing to say about Rust std though. :)