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

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/[email protected]#N)
- The [chacha8 random
source](https://pkg.go.dev/math/rand/[email protected]#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/[email protected]#N)
- The [chacha8 random
source](https://pkg.go.dev/math/rand/[email protected]#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>
thehowl pushed a commit that referenced this issue Oct 3, 2024
<!-- please provide a detailed description of the changes made in this
pull request. -->
related to #1267 
- Implement html golang package.
- Added a silly implementation of strings.Replacer:
Maybe we should optimize it ? I did not wanted to do something complex
as this is not the main point of this pull request

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

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] 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>
@Kouteki Kouteki added this to the ⏭️Next after mainnet milestone Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🌟 Wanted for Launch
Status: In Progress
Status: Triage
Development

No branches or pull requests

3 participants