Welcome! Please see the About page for a little more info on how this works.

0 votes
in Records and Types by

defrecord positional arity factory fn should have an inline version that calls the record constructor

4 Answers

0 votes
by

Comment made by: gfredericks

I had the idea recently that the factory fn was useful partly for being a redefinable var, e.g. that you could wrap with contracts or anything else. This idea would preclude that.

It makes sense though if the only purpose of ->Foo is to avoid having to {{:import}} something.

0 votes
by

Comment made by: hiredman

interesting, that is a good point

0 votes
by

Comment made by: gfredericks

Another thought -- using the factory fns rather than constructors directly gives you a little bit of protection against code-reloading issues, does it not? I don't think I understand the code reloading issues in great detail, so I'm not confident about this. My assumption is that the compiled code refers to vars rather than classes.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-864 (reported by hiredman)
...