Asserting args are equal

10 views
Skip to first unread message

Pedro Silva

unread,
Oct 20, 2023, 2:56:46 PM10/20/23
to Plumbing and Graph: the Clojure utility belt
How can I assert that objectA and objectB have the same type?

[field   :- s/Keyword
    objectA :- s/T
    objectB :- s/T]

They can be any type, but they have to be the same type.

Jason Wolfe

unread,
Oct 21, 2023, 12:22:19 AM10/21/23
to Pedro Silva, Plumbing and Graph: the Clojure utility belt
Thanks for the message.  It's been awhile, but I'm pretty sure we don't support parameterized types like this.  In practice it seems pretty difficult because e.g. for `(defn foo :- T [xs :- [s/T]] ....)` you have to compute the least upper bound of the xs to know how to check the return and that's not really well defined in Clojure I believe.

For documentation purposes you can do `(s/defschema T s/Any)` but it obviously the checker won't actually do anything. 


Confidentiality note: This e-mail may contain confidential information from Nu Holdings Ltd and/or its affiliates. If you have received it by mistake, please let us know by e-mail reply and delete it from your system; you may not copy this message or disclose its contents to anyone; for details about what personal information we collect and why, please refer to our privacy policy.

--
You received this message because you are subscribed to the Google Groups "Plumbing and Graph: the Clojure utility belt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prismatic-plumb...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prismatic-plumbing/987a2f89-7507-42a7-ac44-7cec202a3603n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages