carp-lang / Carp

A statically typed lisp, without a GC, for real-time applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

register-type -- allow users to specify whether to generate getters/setters

scolsen opened this issue · comments

In some cases, registered types should have generated getters but not setters, e.g.:

struct foo {
  MyStruct data[1];
};

If you register-type foo [data MyStruct] you'll get an error during compilation, since it generates a setter for data and MyStruct[1] is not an assignable type. However, getters are still valid.

Perhaps we could permit an optional form in the registration, that, when present, restricts the generated functions:

(register-type foo [(data [getter]) MyStruct])

When omitted, we just use the default behavior and generate all the getters/setters.