Geomol / World

World Programming Language
http://world-lang.org
22 stars 7 forks source link

Modifying a compiled block! should reset its compiled state #3

Closed earl closed 12 years ago

earl commented 12 years ago

Let's start with a simple code block:

w> x: 99 
== 99
w> c: [x]
== [x]
w> do c
== 99 ;; Fine
w> compiled? c
== true

If we now change the block's content, the compiled flag is not reset:

w> append c [* 2]
== [x * 2]
w> c
== [x * 2]
w> compiled? c
== true

Now it could be that it's just marked as "dirty" and recompiled the next time it's evaluated. But no, evaluating the block again returns an unexpected result:

w> do c
== 99 ;; expected: 198
Geomol commented 12 years ago

Modifying a block instance now reset compilation. But APPEND doesn't change the block instance. INSERT and REMOVE does. It's possible to have several block instances of the same array. (Issue can be closed/deleted.)

Geomol commented 12 years ago

APPEND now reset compilation state.