You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implemented generator (yield) support: methods containing yield; / yield expr; / yield key, value; now compile to lazy generators returning an extension-scoped <Namespace>\Generator object (\Iterator + send() + getReturn()) with PHP-identical laziness, auto-key, rewind and exhaustion semantics. Suspension works across while/loop/if/switch, for in <array> (snapshot iteration), range() and object iteration; yield inside try/catch, for ... in iterator(...), closures and functions is rejected at compile time. PHP's \Generator is final, so declare -> <\Iterator>, -> <\Traversable> or omit the return type #1849
Added trait support: trait Name { } and import inside classes/traits. Zephir traits compile to real ZEND_ACC_TRAIT class entries, so PHP userland can use them #504
Changed
Multi-dimensional array assignments (let a[i][j] = v) now skip a redundant final-offset hash lookup in zephir_array_update_multi_ex (three hash operations per write down to two), making tight-loop matrix builds ~15–20% faster (measured via tests/Benchmark/MultiDimArrayBench.php) #1884
Object property reads and writes on this with a compile-time-known name now reuse a per-method interned zend_string for the name and a per-request inline property cache slot (zephir_read_property_cached / zephir_update_property_zval_cached), instead of allocating a zend_string and re-resolving the property offset by hash lookup on every access. This takes this->prop reads from ~0.44× to ~1.35× of native PHP throughput — now faster than interpreted PHP (measured via tests/Benchmark/PropertyAccessBench.php) #1902
Fixed
Fixed arithmetic compound-assignment (+=, -=, *=) on an object property overwriting the property instead of accumulating when the right-hand side is a variable (e.g. let this->total += delta; compiled to let this->total = delta;, dropping the read). The current property value is now read, the operator applied, then written back — matching the already-correct literal-operand path. Arithmetic sibling of the concat-assign fix #2063; found while adding the property inline-cache #1902
Pure-PHP parser parity: a closure-arrow (x => expr) now requires a bare identifier on the left, matching the C parser grammar yield "k" => 2; and let f = "x" => 2; are syntax errors again instead of being mis-parsed #1849
for loops over the ../... range operators (for i in 0..n) now compile to an integer counting loop instead of materializing an intermediate array, matching the existing for i in range(...) optimization; this also lets a typed int loop variable be used with .., which previously failed to compile #2433
A static property initialized with an array literal no longer breaks single-file (concatenated) builds: the zephir_init_static_properties_<Class>() initializer is now forward-declared at file scope in the project .c instead of the per-class header, keeping its declaration and definition in one translation unit so their linkage cannot mismatch (static vs non-static) #2601
This discussion was created from the release 1.1.0.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Added
yield) support: methods containingyield;/yield expr;/yield key, value;now compile to lazy generators returning an extension-scoped<Namespace>\Generatorobject (\Iterator+send()+getReturn()) with PHP-identical laziness, auto-key, rewind and exhaustion semantics. Suspension works acrosswhile/loop/if/switch,for in <array>(snapshot iteration),range()and object iteration;yieldinsidetry/catch,for ... in iterator(...), closures and functions is rejected at compile time. PHP's\Generatoris final, so declare-> <\Iterator>,-> <\Traversable>or omit the return type #1849trait Name { }and import inside classes/traits. Zephir traits compile to realZEND_ACC_TRAITclass entries, so PHP userland canusethem #504Changed
let a[i][j] = v) now skip a redundant final-offset hash lookup inzephir_array_update_multi_ex(three hash operations per write down to two), making tight-loop matrix builds ~15–20% faster (measured viatests/Benchmark/MultiDimArrayBench.php) #1884thiswith a compile-time-known name now reuse a per-method internedzend_stringfor the name and a per-request inline property cache slot (zephir_read_property_cached/zephir_update_property_zval_cached), instead of allocating azend_stringand re-resolving the property offset by hash lookup on every access. This takesthis->propreads from ~0.44× to ~1.35× of native PHP throughput — now faster than interpreted PHP (measured viatests/Benchmark/PropertyAccessBench.php) #1902Fixed
+=,-=,*=) on an object property overwriting the property instead of accumulating when the right-hand side is a variable (e.g.let this->total += delta;compiled tolet this->total = delta;, dropping the read). The current property value is now read, the operator applied, then written back — matching the already-correct literal-operand path. Arithmetic sibling of the concat-assign fix #2063; found while adding the property inline-cache #1902x => expr) now requires a bare identifier on the left, matching the C parser grammaryield "k" => 2;andlet f = "x" => 2;are syntax errors again instead of being mis-parsed #1849forloops over the../...range operators (for i in 0..n) now compile to an integer counting loop instead of materializing an intermediate array, matching the existingfor i in range(...)optimization; this also lets a typedintloop variable be used with.., which previously failed to compile #2433zephir_init_static_properties_<Class>()initializer is now forward-declared at file scope in the project.cinstead of the per-class header, keeping its declaration and definition in one translation unit so their linkage cannot mismatch (staticvs non-static) #2601This discussion was created from the release 1.1.0.
Beta Was this translation helpful? Give feedback.
All reactions