by jonathanstrange · 3y ago · 0 comments
Were the confusion caused by the choice of project name `pcz` instead of `xxxstd`? or any suggestion for us to improve?
This comment is the first time I realised it was not intended to be a drop-in replacement for the Go standard library (in a musl - glibc kind of relationship).
But there was e.g. https://github.com/eloraiby/alt-std for rust, and for D there's a couple listed here - https://wiki.dlang.org/Alternative_Standard_Libraries
So if you're coming at it thinking in those terms, it's 'obviously' the right term to use to describe it.
Note that (a) I wasn't confused at all (b) it makes complete sense people -are- confused by it, and you're not at all wrong.
But, you can't make such types in your own Rust. If you wish you had NonSixU8, a type which can't be six, the only way to make it would be to base it on NonZeroU8 and use some sort of XOR scheme. The standard library is blessed with the ability to do this even though it's not available to mortals and that blessing is only open in practice to the actual standard library for the entirely practical reason that only they can co-ordinate with the compiler team to ensure it happens - if the Rust compiler re-defines how niches work the library team have to change NonZeroU8 at the same time.
So while the actual stdlibs get to do magic, which makes them stand out from a popular third party library like SDL or zlib, these "alternatives" don't.
If they provide all the same stuff as the "real" standard library that makes sense, but when they instead provide different stuff and they can't do magic I don't see any difference from any other library. Is SDL an "alternate stdlib" if we and some friends all use it all the time?
We decided to make it this way so:
1) you can import packages from the pcz std module like you do with any other Go package without setting `GOROOT` to an unofficial std.
2) and because of 1), you can import packages from pcz std in your go application but still using the `go` command rather the `pcz` command.
In the future, we may provide drop-in replacement for applications using official std by introducing a compatibility module and a cli flag to redirect imports using packages from the official std to that module.
The fact that requires a different standard library seems like a consequence of the first decision but it's unclear.
As a Go developer, can I expect to be able to build modules that will work both with both Go's stdlib and pcz std (maybe using build tag guards) ?
Are you building a completely separate ecosystem or can we expect some overlap?
The problem is, in order to build a std, we have to use a lot of <ABIInternal> stuff in assembly, and use internal/abi.FuncPCABIInternal in Go, so we can not make any promise regarding to the inter-std-compatibility for the time being, unless the Go project decided to make these features stable.