tomhrr / dale

Lisp-flavoured C
BSD 3-Clause "New" or "Revised" License
1.03k stars 48 forks source link

Weird problem occured at compile time #64

Closed porky11 closed 8 years ago

porky11 commented 8 years ago

I had some working program, then I added some working code (for creating a circle, I tested that code as a seperate program), and now the compiler just seems to do nothing, normally my computer freezes (normally I can kill the process after a few minutes, and don't have to restart) (see my code at /porky11/planets at github, file game.dt)

tomhrr commented 8 years ago

On Tue, Aug 30, 2016 at 02:40:55PM -0700, Fabio Krapohl wrote:

I had some working program, then I added some working code (for creating a circle, I tested that code as a seperate program), and now the compiler just seems to do nothing, normally my computer freezes (normally I can kill the process after a few minutes, and don't have to restart) (see my code at /porky11/planets at github, file game.dt

I was able to get it to compile and run, with the latest version of the compiler, by commenting out the operator-macros import and changing init-circle to be like so:

(using-namespace std
  (def init-circle (fn intern void ((circle (p (array-of 16 (array-of 2 float)))))
    (let ((i int 0))
      (for true (< i 16) (incv i)
        (setf ($ ($ (@ circle) i) 0) (cosf (*' (/' (pi) 16) i)))
        (setf ($ ($ (@ circle) i) 1) (sinf (*' (/' (pi) 16) i)))))
    (return))))

Although it would be possible to use 'mfor' in the case above, it would require either listing the numbers 0-16 individually or writing a macro that produced the same result, hence the change to 'for'.

operator-macros has shown that there is something odd going on with procedure resolution that needs to be fixed, though, because including that import is enough to send compilation into an endless loop.

porky11 commented 8 years ago

i also had tried it with mfor and had the same problem

tomhrr commented 8 years ago

On Wed, Aug 31, 2016 at 02:52:57PM -0700, Fabio Krapohl wrote:

i also had tried it with mfor and had the same problem

It turns out I'd forgotten to commit one of the fixes required to build the planets project. It should now build and run, when compiled using the current dale master branch.