PythonEditor
PythonEditor copied to clipboard
Feature suggestion: Code round-tripping
The blockly interface is amazing. However, one thing that makes it feel very different from the existing PXT experience is the absence of round-tripping.
I found a paper on round-tripping by one of the blockpy contributors here, in case it is of any use to you for future developments:
https://groups.google.com/forum/#!topic/blockly/kzq_g-jF98c
Good catch... will investigate upon return.
I've played with that specific implementation to round-trip python blocks a while ago, and it worked fine with the autogenerated code, but it had some trouble as soon as you started editing the code to anything slightly different than what the blocks generated.
It is possible to improve the accuracy of the block generation, but it really does feel like a can of worms full of corner cases. I am not really sure we have the capacity (with respect of available time) to implement this to a good enough level where users don't constantly run into "artificial blocks" (autogenerated blocks that do not "exist" in the blockly definitions), code that doesn't convert quite correctly, or plain errors.
@carlosperate one of the common use cases for round-tripping is for a more confident developer to be able to make a program that is subsequently distributed as blocks. Is that a use-case we might support somehow else where we are happy for the developer to be dealing with the corner cases?