-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Problem statement
Blocks can define multiple types on an output connection, this can be used to indicate the returned type is the union or intersection of two types, which is certainly possible in many of the target languages, it can also be used to indicate that a return type could be coerced into one of the types or to simulate inheritance.
Unfortunately though variables don't currently share this ability, so a variable block can only return a single type.
Expected Behavior
Variable blocks should have the same ability as other blocks to return multiple types.
Proposal
Allow an array of strings to be passed as the type of the variable, and adapt the VariableMap to cope with this in a backwards compatible manner.
This is a feature I need atm, so I'll be hacking the variable model & map as a proof of concept. If this is something that would be generally desirable in Blockly, I'd be happy to produce a full PR.