8000 Cross platform standard library · Issue #59 · rusthon/Rusthon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Cross platform standard library #59

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

Open
gradha opened this issue Apr 11, 2015 · 11 comments
Open

Cross platform standard library #59

gradha opened this issue Apr 11, 2015 · 11 comments

Comments

@gradha
Copy link
gradha commented Apr 11, 2015

The transpiled code seems to be highly backend dependant. Attempting something like a basic python slice already breaks c++ code:

def say_hi():
    print( 'hello world'[3:6])
==>
  File "./rusthon.py", line 539, in build
    pak = translate_to_cpp( pyjs, cached_json_files=cached_json )   ## pak contains: c_header and cpp_header
  File "<string>", line 13898, in translate_to_cpp
  File "<string>", line 1244, in visit
  File "<string>", line 13547, in visit_Module
  File "<string>", line 1244, in visit
  File "<string>", line 6341, in visit_FunctionDef
  File "<string>", line 12084, in _visit_function
  File "<string>", line 12212, in generate_generic_branches
  File "<string>", line 1244, in visit
  File "<string>", line 13723, in visit_Print
  File "<string>", line 1244, in visit
  File "<string>", line 10764, in visit_Subscript
__main__.GenerateSlice: {'upper': '6', 'lower': '3', 'slice': <_ast.Slice object at 0x102deabd0>, 'step': None, 'value': 'std::string("hello world")'}

Looks like to do some effective crossplatform program rusthon needs to reimplement a generic standard library which sometimes will map to the native standard library or implement some minimal code. Or maybe I have missed this support. Is it possible to write something like print(a.replace("h", "a")) and have it work on C++, Go, and Java?

@jcrubino
Copy link
Contributor

This should be a priority and the standard tests can be built from this.
Where to start, Math, IO, Filesystem, OS?

@techtonik
Copy link
Contributor

This crosses needs with a PyPy project, where a lot of new languages written in RPython could benefit from such library of functionality with a known behaviour.

@jcrubino
Copy link
Contributor

Great observation

On Tue, Aug 18, 2015 at 5:23 AM, anatoly techtonik <notifications@github.com

wrote:

This crosses needs with a PyPy project, where a lot of new languages
written in RPython could benefit from such library with a known behaviour.


Reply to this email directly or view it on GitHub
#59 (comment).

@wolfv
Copy link
wolfv commented Nov 15, 2015

I would be interested in helping to create a python standard library for the JS backend. E.g. starting with math and random and then looking further to what needs to be done.

Would it make sense to create a repo under the rusthon umbrella for this purpose?

@techtonik
Copy link
Contributor

Any cross-language / cross-platform library should start with some kind of language-independent tests of behavior.

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

No branches or pull requests

5 participants
@gradha @techtonik @jcrubino @wolfv and others
0