<< Back to previous view

[CTYP-98] Implement a defrecord macro for Clojure Created: 23/Nov/13  Updated: 20/Jul/15

Status: Open
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: Backlog

Type: Enhancement Priority: Minor
Reporter: Reid McKenzie Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File defrecord    


In the interests of rendering c.c.t code more concise, implement a defrecord> macro wrapping defrecord and ann-record.

Comment by Ambrose Bonnaire-Sergeant [ 03/Dec/13 12:57 PM ]

There is another case I would like to consider: specifying polymorphic ancestors. Currently ann-datatype/ann-record take an undocumented keyword argument :unchecked-ancestors.


(ann-protocol [[x :variance :invariant]] Foo
  [(Foo x) -> x])
(defprotocol> Foo
  (-foo [this]))

(ann-datatype DTFoo [m :- Any]
  :unchecked-ancestors [(Foo String)])
(deftype DTFoo [m]
  ; this next line might read (Foo String), instead of :unchecked-ancestors entry
  (-foo [this] "a"))

I will revisit this issue once I've ironed out how :unchecked-ancestors should work.

Generated at Mon Nov 30 11:18:37 CST 2015 using JIRA 4.4#649-r158309.