<< Back to previous view

[CCONTRACTS-2] Does clojurescript support work for core.contracts? Created: 06/Sep/13  Updated: 06/Sep/13

Status: Open
Project: core.contracts
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Stephen Cagle Assignee: Fogus
Resolution: Unresolved Votes: 0
Labels: None



I have a pedestal app I am working on. I have made some really helpful (at least to me) use of core.contracts in testing my clojure/clojurescript shared code (in clojure) using test.generative. When I open my code in the browser though and try to bring a namespace that makes use of core.contracts into clojurescript, I get the following error. None of the constraints I wrote actually make use of any native java types (at least I don't think). I am mostly just checking that the values of things align with what I expect in the inputs and outputs.

In my behavior.clj I have

(ns ^:shared com.samedhi.contracts.app.behavior
(:require [clojure.string :as string]
[io.pedestal.app.messages :as msg]
[clojure.zip :as z])
(:use [clojure.core.contracts :only [contract with-constraints]]
[clojure.core.contracts.constraints :only [defconstrainedfn]]
[clojure.test :only [is]]))

which compiles into cljs as

which throws a javascript exception at goog.require('clojure.core.contracts.constraints') when I look in the data-ui view, saying:

errorMessage: "goog.require could not find: clojure.core.contracts.constraints"
name: "clojure.core.contracts.constraints"

Is there some sort of special way I need to import things within clojurescript to use core.contracts?

BTW, I really appreciate core contracts, it is really neato. Thanks for you work.

Generated at Mon Jan 16 15:56:22 CST 2017 using JIRA 4.4#649-r158309.