Skip to content

deprecate substring block and create new one w/ optional length #6184

Closed
microsoft/pxt
#10562
@riknoll

Description

@riknoll

see discussion here: microsoft/pxt#10559

the substring block requires length as a parameter but it's optional in the JavaScript. as a result, decompiling some code where you don't provide that parameter ends up giving you a block with a hole in it.

to fix this, we should deprecate the old block and make a new one where the parameter is optional (with a + button). because we can't rename this function, whoever does this will need to:

  • create a new function with the same signature as String.substring (but with an underscore at the beginning)
  • copy the blockId/definition to the new API
  • add a new blockId/definition to the original API with the optional parameter
  • add the blockAliasFor annotation to the new API to point to the old API so that it gets compiled to the same JavaScript

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions