Open dlech opened 5 years ago
One idea I had for designating the "owner" of a block is only allowing block objects to be declared within the body of another block.
// compile error: block object cannot be top-level object
block Bad {
}
vmthread Thread1 {
DATA8 v1
block Block1 {
// compile error: block cannot contain local variables
DATA8 v2
MOVE8_8(1,v1) // OK
block Block2 {
// block in block is OK
// is owner Block1 or Thread1? probably Thread1 since it has the local variables
}
}
}
Hello. Are there any changes in using a block object in a program?
No, these changes have not been made yet. So using block objects is limited at this time.
Currently, block objects are not properly implemented.
Block objects have a couple of interesting properties:
So, we need to figure out how to encode these two properties in the assembly language.
Also we need to fix the allocation of local variables. There are comments in the LMS2012 source code that indicate that the object header for blocks should have a local variable size of 0. However, code generated by the official EV3 programming software uses the same size as the owner object instead of 0.