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

sort.Slice implementation #750

Open
schollz opened this issue Apr 18, 2023 · 4 comments
Open

sort.Slice implementation #750

schollz opened this issue Apr 18, 2023 · 4 comments

Comments

@schollz
Copy link
Contributor

schollz commented Apr 18, 2023

Hi all! I still getting used to gno and noticed that I'm getting a panic when using sort.Slice:

panic: name Slice not declared [recovered]
        panic: ./examples/gno.land/p/demo/microblog/microblog.gno:154: name Slice not declared

I looked through the codebase and can see that this seems not to be available in gno, and I was wondering whether this is correct, and if there is a reason. I'm happy to attempt adding it to gno, unless there is a particular reason its left out.

@thehowl
Copy link
Member

thehowl commented Apr 18, 2023

As far as I know, the same reason ufmt.Sprintf doesn't match fmt.Sprintf - they require reflection, and whether or not to have a reflect package in Gno is up for debate.

I recall having already stumbled upon this issue in the past, and since I was in Go before sort.Slice was implemented and would never go back, I think that even if we decide to not implement reflection in Gno, the Slice function is so immensely useful it ought to be implemented as a native binding.

@schollz
Copy link
Contributor Author

schollz commented Apr 18, 2023

Thanks. Its not a deal breaker for me not to have sort.Slice - I was able to write Go code pre1.8 without it and I can do it again 😄 , but it might be worth leaving the issue open to track it?

Also, is there an ongoing debate about reflection? It would be useful to link a reflection discussion to this issue (and also for my own edification about its pros/cons re: gno)

@thehowl
Copy link
Member

thehowl commented Apr 18, 2023

Not as far as I know. @moul do you think it's worth making an issue to discuss this, or is reflection more in the ballpark of "we want it, just didn't do it yet"?

@moul
Copy link
Member

moul commented Apr 19, 2023

Let's keep the discussion open until we create a meta issue to gather everything and establish a backlink. Ultimately, we need to find practical solutions to support both fmt and sort.Slice.

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
Development

No branches or pull requests

4 participants