replete-repl / replete-ios

ClojureScript REPL iOS app
Eclipse Public License 1.0
395 stars 25 forks source link

defrecord doesn't work #25

Closed aengelberg closed 8 years ago

aengelberg commented 9 years ago
> (defprotocol P)
nil
> (reify)
#<[object Object]>
> (reify P)
#<[object Object]>
> (defrecord MyRecord [x])
undefined is not a function
...

Maybe defrecord is not yet implemented?

aengelberg commented 9 years ago

There's a different error in the cljs repl from the famous 3-step tweet.

cljs-bootstrap.repl> (defrecord R [])
Error
    at new cljs$core$ExceptionInfo ([stdin]:33197:11)
    at Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 ([stdin]:33238:10)
    at cljs$core$ex_info ([stdin]:33228:32)
    at Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$3 ([stdin]:38612:28)
    at cljs$analyzer$error ([stdin]:38602:34)
    at cljs$analyzer$macroexpand_1 ([stdin]:41626:35)
    at Function.cljs.analyzer.analyze_seq.cljs$core$IFn$_invoke$arity$4 ([stdin]:41676:45)
    at cljs$analyzer$analyze_seq ([stdin]:41643:40)
    at cljs.core.reduce.call.or__4069__auto__ ([stdin]:41912:48)
    at Function.cljs.analyzer.analyze.cljs$core$IFn$_invoke$arity$4 ([stdin]:41943:8)

I don't know enough about cljs bootstrapping to know how much functionality is related between the available REPLs.

mfikes commented 9 years ago

@kanaka ^ you may find this one interesting as well

mfikes commented 9 years ago

http://dev.clojure.org/jira/browse/CLJS-1321

aengelberg commented 9 years ago

Apparently has been fixed in ClojureScript master.

On Wed, Jul 1, 2015 at 1:25 PM, Mike Fikes notifications@github.com wrote:

http://dev.clojure.org/jira/browse/CLJS-1321

— Reply to this email directly or view it on GitHub https://github.com/mfikes/replete/issues/25#issuecomment-117815954.

mfikes commented 9 years ago

Yes. I was attempting to confirm the fix, but I now get an error regarding rname.getNamespace()

mfikes commented 9 years ago

Ahh... it is fixed (or at least has moved on to the next error regarding set!. My issue is I needed to blow away my resources directory.

kanaka commented 9 years ago

The "set!" error is: http://dev.clojure.org/jira/browse/CLJS-1325

mfikes commented 9 years ago

Now, we are down to this:

(defrecord R [])
WARNING: No such namespace: core, could not locate core.cljs, core.cljc, or Closure namespace ""
WARNING: Use of undeclared Var core/list
asheldo commented 9 years ago

So, is the remaining error this?: SyntaxError: Unexpected token .

Unless I am missing something with the expression. This also happens when I'm just def'ing a var. Maybe it is related to analyzer.cljc(defn resolve-var [env sym])? The result prior to js/eval is:

cljs-bootstrap.core=>  (with-out-str (ensure (c/emit (no-warn (ana/analyze
              (assoc (ana/empty-env) :context :expr)
              '(def v 1))))))
".v = 1" 

Same with `(def v# 1) and defrecord when I try in cljs-bootstrap.

mfikes commented 9 years ago

@asheldo With the latest master, I can't see, owing to #63

aengelberg commented 8 years ago

Can this be closed?

mfikes commented 8 years ago

Yep. 👍