Pinpointer icon indicating copy to clipboard operation
Pinpointer copied to clipboard

Lumo error on require of pinpointer.core

Open arichiardi opened this issue 6 years ago • 3 comments

Hi!

I am trying this wonderful library with lumo and I get the following error when I require the main namespace:

Could not require pinpointer.core in file ep_cloud/dev.cljs
	 (new)
	 Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:2024:72)
	 Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:2660:92)
	 (NO_SOURCE_FILE <embedded>:5660:320)
	 (Object.lumo.repl.run_sync_BANG_)
	 Object.cljs.js.process_deps (NO_SOURCE_FILE <embedded>:5637:185)
	 Object.cljs.js.process_libs_deps (NO_SOURCE_FILE <embedded>:5640:60)
	 (NO_SOURCE_FILE <embedded>:5658:474)
	 (Object.lumo.repl.run_sync_BANG_)
	 Object.cljs.js.process_deps (NO_SOURCE_FILE <embedded>:5637:185)

Unexpected eval or arguments in strict mode
	 createScript (vm.cljs:80:10)
	 Object.runInThisContext (vm.cljs:152:10)
	 (Object._t)
	 lumo.repl.caching_node_eval (NO_SOURCE_FILE <embedded>:6481:68)
	 (NO_SOURCE_FILE <embedded>:5659:410)
	 (Object.lumo.repl.run_sync_BANG_)
	 Object.cljs.js.process_deps (NO_SOURCE_FILE <embedded>:5637:185)
	 Object.cljs.js.process_libs_deps (NO_SOURCE_FILE <embedded>:5640:60)
	 (NO_SOURCE_FILE <embedded>:5658:474)
	 (Object.lumo.repl.run_sync_BANG_)

Any hint of what that can be?

arichiardi avatar Feb 01 '18 02:02 arichiardi

Hi, @arichiardi

Thank you for reporting the issue :) That error can be reproduced in my environment too. It looks like the error message is complaining Pinpointer's use of eval, which is necessary for the error analysis and so seems hard to remove it completely from Pinpointer.

Perhaps a quick workaround is to disable Lumo's --use-strict flag for your development time (see here for the details), but I'll dig into it a little more.

athos avatar Feb 01 '18 11:02 athos

Will try that out and report back!

arichiardi avatar Feb 02 '18 02:02 arichiardi

I have tried to have a dev.cljs in a file:

(ns pkg.dev
  (:require
            [cljs.spec.alpha :as s]
            [cljs.test :as test]
            lumo.core
            lumo.repl
            [cljs.spec.test.alpha :as stest]))

(enable-console-print!)

;; https://github.com/anmonteiro/lumo/issues/28
(def v8 (js/require "v8"))
(.setFlagsFromString v8 "--no-use_strict")

;; Trying out a couple of libs for better spec printing
;; (set! s/*explain-out* expound/printer)
(require '[pinpointer.core :as pinpointer])
(set! s/*explain-out* (partial pinpointer/pinpoint-out
                               {:colorize true
                                :eval lumo.core/eval}))

And while this works at the REPL, it does not when loading with the -i file.

Probably something still connected to https://github.com/anmonteiro/lumo/issues/28

arichiardi avatar Feb 02 '18 18:02 arichiardi