#46: Late cross-scripts bindings
------------------------+---------------------------------------------------
 Reporter:  mrpingouin  |       Owner:  mrpingouin
     Type:  Bugs        |      Status:  new       
 Priority:  1           |   Milestone:            
Component:  Liquidsoap  |     Version:            
 Keywords:              |  
------------------------+---------------------------------------------------
 Balbinus raised an issue by mail today:
 {{{
 $ liquidsoap 'def out(s) = output.file.wav("/tmp/test.wav", out(s))
 end;out(blank())'
 Line 1, char 71: Unknown error
 Fatal error: exception Stack_overflow
 }}}

 This is not a parse error but an infinite evaluation: the "def out" ends
 up being recursive, which is a bug. The problem is that the lookup for
 variables defined outside the script is dynamic -- see the toplevel_lookup
 stuff, which is already marked as in need for a review.

 At the point where "out" is looked up (i.e. "out(blank())"), the
 definition of "out" in the toplevel bindings is not the one from utils.liq
 anymore but already the new one. And when it is substituted, applied, and
 another "out" occurs, the same definition unrolls, and so on and so on.

 The bug is identified, I'll fix that later. For now, avoid such
 constructions ;)

-- 
Ticket URL: <http://savonet.rastageeks.org/ticket/46>
Savonet <http://savonet.rastageeks.org/>
Let's program our stream !

Répondre à