MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 2 | void dangling_lfun_closure() |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
| 4 | DESCRIPTION |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 5 | Handle a dangling lfun-closure. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 6 | |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 7 | This is called when the gamedriver executes a closure using a |
| 8 | vanished lfun, with previous_object() showing the originating |
| 9 | object. A proper handling is to raise a runtime error. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 10 | |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 11 | Technical: |
| 12 | Upon replacing programs (see efun replace_program()), any |
| 13 | existing lambda closures of the object are adjusted to the |
| 14 | new environment. If a closure uses a lfun which vanished in |
| 15 | the replacement process, the reference to the lfun is |
| 16 | replaced by an alien-lfun closure referencing to this function. |
| 17 | The error will then occur when the execution of the adjusted lambda |
| 18 | reaches the point of the lfun reference. There are two reasons for |
| 19 | the delayed handling. First is that the program replacement and with |
| 20 | it the closure adjustment happens at the end of a backend cycle, |
| 21 | outside of any execution thread: noone would see the error at this |
| 22 | time. Second, smart closures might know/recognize the program |
| 23 | replacement and skip the call to the vanished lfun. |
| 24 | |
| 25 | HISTORY |
| 26 | Since LDMud 3.2.9, all references to dangling_lfun_closure() are |
| 27 | created as alien-lfun closures. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 28 | |
| 29 | SEE ALSO |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 30 | closures(LPC) |