Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[META] Standard Library wishlist #1267

Open
thehowl opened this issue Oct 20, 2023 · 0 comments
Open

[META] Standard Library wishlist #1267

thehowl opened this issue Oct 20, 2023 · 0 comments
Assignees
Labels
⭐️ could have ⭐️ Optional work needed to complete a project

Comments

@thehowl
Copy link
Member

thehowl commented Oct 20, 2023

See Go<>Gno compatibility for a current state.

This issue is intended as a starting place for anyone who wants to work on adding new standard libraries to Gno. It's an opinionated collection of libraries which I think should be added to the Gno standard libraries.

  • If you want to make a case for a standard library to be added, add a comment explaining your reasoning.
  • If you want to port over a standard library, make an issue for it and assign yourself (if it's going to take a while), referencing this PR. If you can do it quickly, make a PR referencing this issue!

General workflow for adding stdlibs:

  1. Copy over from your /usr/lib/go/src/$path directory
  2. Convert all go files to gno: for i in *.go; do g="$(echo $i | sed 's/.go$/.gno/')"; mv $i $g; done
  3. go test tests/*.go -run "TestPackages/your/package/path", fix, repeat until it works! (run from gnovm directory)

Consider, of course, adding new tests where appropriate, and disabling features when we don't support them (like reflect for now).

Up for grabs

Better after native bindings #859

Crypto libraries are generally better after native bindings as they greatly benefit from native performance.

  • crypto/aes
  • crypto/des
  • crypto/dsa
  • crypto/ecdh
  • crypto/ecdsa
  • crypto/ed25519
  • crypto/hmac
  • crypto/elliptic
  • crypto/md5
  • crypto/rsa
  • crypto/sha1
  • reflect
  • strconv
  • text/scanner
  • text/tabwriter

Better after reflection

  • encoding/asn1
  • encoding/json
  • encoding/gob (not sure about this, but it could be fun!)
  • encoding/xml
  • encoding/binary (full)
  • fmt
  • html/template
  • text/template
  • text/template/parse
  • sort
  • errors update (Is, As, Unwrap...)

Possibly, but need discussion

  • math/big

tags: stdlibs stdlib encoding/json reflect

@thehowl thehowl self-assigned this Oct 20, 2023
moul pushed a commit that referenced this issue Oct 25, 2023
<!-- please provide a detailed description of the changes made in this
pull request. -->

Add hash stdlib (especially adler32) and add encoding for dependency

## relate issue

#1267
gfanton pushed a commit to gfanton/gno that referenced this issue Nov 9, 2023
<!-- please provide a detailed description of the changes made in this
pull request. -->

Add hash stdlib (especially adler32) and add encoding for dependency

## relate issue

gnolang#1267
moul pushed a commit to moul/gno that referenced this issue Nov 14, 2023
<!-- please provide a detailed description of the changes made in this
pull request. -->

Add hash stdlib (especially adler32) and add encoding for dependency

## relate issue

gnolang#1267
thehowl added a commit that referenced this issue Jun 28, 2024
This PR ports over to Gno the
[math/rand/v2](https://pkg.go.dev/math/rand/v2) Go package. It provides
pseudo-random number generation.

Notable omissions:

- the [`N` generic function](https://pkg.go.dev/math/rand/v2@go1.22.4#N)
- The [chacha8 random
source](https://pkg.go.dev/math/rand/v2@go1.22.4#ChaCha8) (we can use
PCG instead; and chacha8 can be implemented later)

This PR requires a version bump to go 1.22 to have math/rand/v2 in the
standard libraries; otherwise the Native tests won't work. We can
rollback the changes to move it to 1.22 by removing the native math/rand
implementation, and only using the stdlibs.

BREAKING CHANGE: existing usages of math/rand used Go's math/rand;
however, in this new standard library we use its v2, so results will be
different.

Closes #1272; See-also #1267 

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [x] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>
gfanton pushed a commit to gfanton/gno that referenced this issue Jul 23, 2024
This PR ports over to Gno the
[math/rand/v2](https://pkg.go.dev/math/rand/v2) Go package. It provides
pseudo-random number generation.

Notable omissions:

- the [`N` generic function](https://pkg.go.dev/math/rand/v2@go1.22.4#N)
- The [chacha8 random
source](https://pkg.go.dev/math/rand/v2@go1.22.4#ChaCha8) (we can use
PCG instead; and chacha8 can be implemented later)

This PR requires a version bump to go 1.22 to have math/rand/v2 in the
standard libraries; otherwise the Native tests won't work. We can
rollback the changes to move it to 1.22 by removing the native math/rand
implementation, and only using the stdlibs.

BREAKING CHANGE: existing usages of math/rand used Go's math/rand;
however, in this new standard library we use its v2, so results will be
different.

Closes gnolang#1272; See-also gnolang#1267 

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [x] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>
@zivkovicmilos zivkovicmilos added the ⭐️ could have ⭐️ Optional work needed to complete a project label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐️ could have ⭐️ Optional work needed to complete a project
Projects
Status: 🌟 Wanted for Launch
Status: In Progress
Development

No branches or pull requests

2 participants