|
|
|
|
|
by jakubmisek
3251 days ago
|
|
For example one CLR limitation - `yield` cannot be in a catch block. Two workarounds - compiler can generate a crazy state machine or user can just move the PHP yield outside the catch. Error handling is a big issue - in PHP every notice and warning can be handled in user code, in .NET we use Debug Assertions or exceptions. But .NET has threads and async which shares one thread by more requests, so in case of error we just don't know what request has to handle the error. We would have to pass some request context object to every function in runtime in order to be able to let the correct request's error_handler to handle the error - or we just assume warnings and errors should not happen and crash when it does. Garbage Collection - for performance reasons (and sanity) we let .NET GC to do its job. But unlike PHP's GC it is undeterministic and does its job on a different thread. For now, __destruct is not handled in Peachpie yet cause there are more ways on how to simulate PHPs behavior. Changing existing closure's $this to anything - well.. besides it would make type analysis useless, it totaly violates strong .NET method access checks. |
|