Visitar URL original
vm::obj -> vm::builtins and expose types right under builtins rather than each objxxx submodules by youknowone · Pull Request #2281 · RustPython/RustPython · GitHub
The Wayback Machine - https://web.archive.org/web/20260518184525/https://github.com/RustPython/RustPython/pull/2281
Skip to content

vm::obj -> vm::builtins and expose types right under builtins rather than each objxxx submodules#2281

Merged
youknowone merged 3 commits into
RustPython:masterfrom
youknowone:builtins
Oct 12, 2020
Merged

vm::obj -> vm::builtins and expose types right under builtins rather than each objxxx submodules#2281
youknowone merged 3 commits into
RustPython:masterfrom
youknowone:builtins

Conversation

@youknowone
Copy link
Copy Markdown
Member

No description provided.

@youknowone youknowone force-pushed the builtins branch 4 times, most recently from ec4f98a to 537e49a Compare October 12, 2020 02:34
@youknowone youknowone marked this pull request as ready for review October 12, 2020 02:51
@youknowone
Copy link
Copy Markdown
Member Author

@coolreader18 I want quick review for this PR. this is a huge source of conflict. this is making builtins as a vm sub module which matches to the bulitins module concept in python. It also will make breaking change to RustPython API surface. Users should use use rustpython_vm::builtins::PyInt after the change.
vm/src/builtins/mod.rs is not clear enough but i will be going to improve it.

Copy link
Copy Markdown
Member

@coolreader18 coolreader18 left a comment •

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think overall this is a good idea, though I feel like one namespace for everything might not be great. Maybe we could have pub mod foo; and just export PyFoo, PyFooRef under builtins/mod.rs and then we could still keep utility functions related to foo/foo-like objects under builtins::foo. Specifically thinking about stuff like objiter, objsequence, though maybe those should go in something like CPython's abstract.c.

@youknowone
Copy link
Copy Markdown
Member Author

youknowone commented Oct 12, 2020 •

I think exporting PyFoo, PyFooRef is better than *. About utilities, I vote for the latter. I think objiter utilities are better to be moved out of builtins module. About objsequence, it even is not a builtins component. I will do it in other PR to avoid conflicts

@youknowone youknowone merged commit b2c0a69 into RustPython:master Oct 12, 2020
@youknowone youknowone deleted the builtins branch October 12, 2020 03:41
@youknowone
Copy link
Copy Markdown
Member Author

youknowone commented Oct 12, 2020 •

Oh, one things I think good to have in builtins are isinstance and issubclass. which are actually matching to the concept of builtin functions.

They had different behaviors. I will make objtype::isinstance to trait method of TypeProtocol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants