News for hackers. Stuff that matters.
Re:PHP: why GOTO instead of recursion? by masklinn on Tuesday September 23, 2014 @12:41PM (#8356262)
> That would (partially) explain why you can't statically evaluate it to `\true`.

Yes, but that only requires a guard clause. That's what CPython 2 does in the same situation:

    >>> import dis
    >>> def foo():
    ...     while True:
    ...             print "ok"
    ... 
    >>> dis.dis(foo)
      2           0 SETUP_LOOP              15 (to 18)
            >>    3 LOAD_GLOBAL              0 (True)
                  6 POP_JUMP_IF_FALSE       17

      3           9 LOAD_CONST               1 ('ok')
                 12 PRINT_ITEM          
                 13 PRINT_NEWLINE       
                 14 JUMP_ABSOLUTE            3
            >>   17 POP_BLOCK           
            >>   18 LOAD_CONST               0 (None)
                 21 RETURN_VALUE        
(in Python 3, True and False are keywords so the loop prelude can be elided entirely)

There are no comments on this comment yet.