[[ Bug 20931 ]] Bridge values in LCB assign-array and assign-list ops#6310
Conversation
This patch fixes a bug where the behavior of code built using the
[ ... ] and { ... } syntax in LCB is different from that when using
explicit code.
A new method 'Bridge' has been added to the VM's execute context.
This method performs a 'convert to optional any' on the input value
resulting in bridgeable foreign values being imported, and all other
values being retained.
This method is now called on the input values in the assign-list
and assign-array opcodes meaning that foreign values being built
into lists will bridge.
Additionally, an extra compiler check has been added to variadic
arguments (i.e. arguments to the variadic portion of a C variadic
handler). This check restricts such arguments to being variable
identifiers where the variable has an explicit type declaration.
This is necessary to ensure that code explicitly states the type
which is being passed in variadic positions as there is no other
means for the compiler or the VM to know what the type should be.
adf23bf to
a7125ee
Compare
|
One possible concern (that I'm sure you've considered) is that this change may make it harder to manage collections of foreign values without paying the cost of bridging. |
|
@peter-b : Hehe - indeed! The idea here is that the VM has three kinds of slot - temporary which hold values as they are, typed which convert a value on assignment and untyped which bridge but do not convert. As lcb doesn't yet have typed lists, we take the element of type of lists as they are now as 'untyped'. In the future lists of foreign values will be managed by being able to specify list of . I.e. Foreign values only stay foreign if bring places in temporary or types slots. |
|
All apparently explicitly typed params to variadic functions now seem to be failing, eg:
|
| put false into tVar | ||
|
|
||
| variable tValue as Pointer | ||
| put MCProperListFetchElementAtIndex([tVar], 1) into tValue |
There was a problem hiding this comment.
The index to MCProperListFetchElementAtIndex should be 0 no?
|
@livecode-vulcan review ok 615a87b |
|
💙 review by @livecodeian ok 615a87b |
[[ Bug 20931 ]] Bridge values in LCB assign-array and assign-list ops
This patch fixes a bug where the behavior of code built using the
[ ... ] and { ... } syntax in LCB is different from that when using
explicit code.
A new method 'Bridge' has been added to the VM's execute context.
This method performs a 'convert to optional any' on the input value
resulting in bridgeable foreign values being imported, and all other
values being retained.
This method is now called on the input values in the assign-list
and assign-array opcodes meaning that foreign values being built
into lists will bridge.
Additionally, an extra compiler check has been added to variadic
arguments (i.e. arguments to the variadic portion of a C variadic
handler). This check restricts such arguments to being variable
identifiers where the variable has an explicit type declaration.
This is necessary to ensure that code explicitly states the type
which is being passed in variadic positions as there is no other
means for the compiler or the VM to know what the type should be.
|
😎 test success 615a87b
|
This patch fixes a bug where the behavior of code built using the
[ ... ] and { ... } syntax in LCB is different from that when using
explicit code.
A new method 'Bridge' has been added to the VM's execute context.
This method performs a 'convert to optional any' on the input value
resulting in bridgeable foreign values being imported, and all other
values being retained.
This method is now called on the input values in the assign-list
and assign-array opcodes meaning that foreign values being built
into lists will bridge.
Additionally, an extra compiler check has been added to variadic
arguments (i.e. arguments to the variadic portion of a C variadic
handler). This check restricts such arguments to being variable
identifiers where the variable has an explicit type declaration.
This is necessary to ensure that code explicitly states the type
which is being passed in variadic positions as there is no other
means for the compiler or the VM to know what the type should be.