rfc:closure_self_reference

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:closure_self_reference [2023/06/03 19:23] danackrfc:closure_self_reference [2023/06/03 21:01] (current) – Typo danack
Line 105: Line 105:
  
 <code php> <code php>
-$fibonacci = function $fn(int $n) as $fn {+$fibonacci = function $fn(int $n) {
     if ($n === 0) return 0;     if ($n === 0) return 0;
     if ($n === 1) return 1;     if ($n === 1) return 1;
Line 111: Line 111:
 }; };
  
-$factorial = fn $fn(int $num) as $fn : int => $num > 1 ? $num * $fn($num - 1) : $num;+$factorial = fn $fn(int $num): int => $num > 1 ? $num * $fn($num - 1) : $num;
 </code> </code>
  
Line 128: Line 128:
  
 <code php> <code php>
-$factorial = fn(int $num) as $fn: int => $num > 1 ? $num * $fn($num - 1) : $num;+$factorial = fn(int $num): int => $num > 1 ? $num * $fn($num - 1) : $num;
 </code> </code>
  
Line 147: Line 147:
  
  
-===== Syntax choice =====+===== Syntax choice evaluation =====
  
 Of the syntaxes considered, the following syntaxes are excluded for the reasons listed: Of the syntaxes considered, the following syntaxes are excluded for the reasons listed:
rfc/closure_self_reference.1685820218.txt.gz · Last modified: 2023/06/03 19:23 by danack