<< Back to previous view

[CTYP-98] Implement a defrecord macro for Clojure Created: 23/Nov/13  Updated: 03/Dec/17  Resolved: 03/Dec/17

Status: Closed
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: Declined 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.

Comment by Ambrose Bonnaire-Sergeant [ 03/Dec/17 4:20 PM ]

Unclear how to proceed.

Generated at Fri Jan 19 21:56:00 CST 2018 using JIRA 4.4#649-r158309.