Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cross platform standard library #59

Open

Description

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /