[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
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

Implement sorted() builtin #16

Closed
trotterdylan opened this issue Jan 4, 2017 · 4 comments
Closed

Implement sorted() builtin #16

trotterdylan opened this issue Jan 4, 2017 · 4 comments

Comments

Copy link
Collaborator

trotterdylan commented Jan 4, 2017

No description provided.

Copy link
Contributor

MirkoDziadzka commented Jan 17, 2017

Just curious, is there a way in grumpy to implement a builtin function in Python?

My naïve approach of adding a Python implementation of sorted() to lib/__buildin__.py does not work (see MirkoDziadzka@0fe34ae)

Copy link
Collaborator Author

trotterdylan commented Jan 17, 2017

This limitation is briefly discussed here: #50

I haven't given it a whole lot of thought but I think it's actually a bit of a pain to make this work. The basic issue is that the __builtin__ Go package would need to import grumpy (the runtime package) to work properly, and the runtime package would need to import __builtin__ so that it could populate it with the stuff implemented in Go. So there's a circular dependency.

Unfortunately, we do need to get this working because there is Python code out there that adds its own functions to __builtin__.

One possible approach would be to have __builtin__.py replace its own module __dict__ with __go__.grumpy.Builtins. I don't think this would work as-is, but something along these lines:

# __builtin__.py
from __go__.grumpy import Builtins
import sys
sys.modules['__builtin__'].__dict__ = Builtins
Copy link
Contributor

MirkoDziadzka commented Jan 17, 2017

looks like sorted() is already implemented in #100 via 384954e

Copy link
Collaborator Author

trotterdylan commented Jan 18, 2017

Whoops, sorry about that Mirko. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants