tomhrr / dale

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

Special parameters of setf don't work in struct definitions #98

Closed porky11 closed 8 years ago

porky11 commented 8 years ago

The definitions for structs and arrays evaluate in a special way, if the type of the variable matches, but in some cases (only inside struct-definitions, I think) it is not possible, even if the type is known

(def X (struct intern ((value (array-of 2 int)))))

(def main (fn extern-c void (void)
  (def a (var auto (array-of 2 int) (array 1 1))) ;;possible
  (setv a (array 0 0)) ;;possible
  (def x (var auto X ((value (array 1 2))))))) ;;not possible

Shouldn't it work in this case too?

tomhrr commented 8 years ago

On Tue, Sep 13, 2016 at 03:43:09PM -0700, Fabio Krapohl wrote:

The definitions for structs and arrays evaluate in a special way, if the type of the variable matches, but in some cases (only inside struct-definitions, I think) it is not possible, even if the type is known

(def X (struct intern ((value (array-of 2 int)))))

(def main (fn extern-c void (void) (def a (var auto (array-of 2 int) (array 1 1))) ;;possible (setv a (array 0 0)) ;;possible (def x (var auto X ((value (array 1 2))))))) ;;not possible

Shouldn't it work in this case too?

Yep, this should now work properly.