PythonEditor icon indicating copy to clipboard operation
PythonEditor copied to clipboard

Feature suggestion: Code round-tripping

Open whaleygeek opened this issue 8 years ago • 3 comments

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

whaleygeek avatar Feb 16 '17 00:02 whaleygeek

Good catch... will investigate upon return.

ntoll avatar Feb 16 '17 02:02 ntoll

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 avatar Mar 03 '17 20:03 carlosperate

@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?

jaustin avatar Mar 15 '17 12:03 jaustin