digego / extempore

A cyber-physical programming environment
1.4k stars 127 forks source link

examples/external/gui.xtm fails #241

Closed tjltjl closed 8 years ago

tjltjl commented 8 years ago

Trying to run the gui test fails with a strange error:

....[Lots of compilation]...

Compiled:  Widget_left_child >>> [Widget*,Widget*]*
Compiled:  Widget_set_left_child >>> [Widget*,Widget*,Widget*]*
Compiled:  Widget_right_child >>> [Widget*,Widget*]*
Compiled:  Widget_set_right_child >>> [Widget*,Widget*,Widget*]*
Compiled:  Widget_print >>> [void,Widget*]*
Compiled:  Widget_toString >>> [String*,Widget*]*
Compiler Error cannot find closure Widget_print
tjltjl commented 8 years ago

Replacing

(bind-poly print Widget_print)

with

(bind-func print:[void,Widget*]* (lambda (a) (Widget_print a)))

gets past that error... is that the correct fix?

tjltjl commented 8 years ago

...apparently there is some more bitrot in the file, there is an if with only one branch later on, and the compiler complains about it

tjltjl commented 8 years ago

...and later on in the file, when compiling gui_render_subtree, I get something really weird:

Type Error bad type notype ((Widget_cb##506 widget) widget bounds)

benswift commented 8 years ago

Yep, it seems like this example has been borked recently by the changes to xtlang's polymorphism. I've just pushed up some fixes to get it to compile (8218d22) but there's still something going wrong with displaying the widgets - will investigate as soon as I can.

tjltjl notifications@github.com writes:

Replacing

(bind-poly print Widget_print)

with

(bind-func print:[void,Widget*]* (lambda (a) (Widget_print a)))

gets past that error... is that the correct fix?


Reply to this email directly or view it on GitHub: https://github.com/digego/extempore/issues/241#issuecomment-187155768

tjltjl commented 8 years ago

Interestingly, it seems that simply rerunning the definition of gui_render_subtree (i.e. rerunning that one bind-func) fixes the behaviour at runtime.

Something badly wrong with recursion?

benswift commented 8 years ago

Seems to be fixed as at 7c0dcac