This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-27
Channels
- # announcements (13)
- # babashka (59)
- # beginners (58)
- # bitcoin (3)
- # calva (7)
- # cider (2)
- # cljsrn (4)
- # clojure (41)
- # clojure-dev (18)
- # clojure-germany (1)
- # clojurescript (14)
- # conjure (7)
- # cursive (5)
- # datahike (1)
- # graalvm (44)
- # jobs-discuss (3)
- # kaocha (19)
- # lsp (109)
- # luminus (3)
- # off-topic (8)
- # pathom (32)
- # re-frame (4)
- # reveal (3)
- # shadow-cljs (16)
- # spacemacs (5)
- # sql (18)
- # vim (13)
@wilkerlucio Should now work on master :)
./bb -e '(defprotocol Foo (foo [_])) (extend-protocol Foo clojure.lang.Atom (foo [this] @this)) (foo (atom 1))'
1
good luck! 👍
seems like my utils are compiling fine now!
this is the next I found 🙂
----- Error --------------------------------------------------------------------
Type: java.lang.IllegalArgumentException
Message: No implementation of method: :getName of protocol: #'sci.impl.vars/HasName found for class: nil
Location: /Users/wilkerlucio/Development/pathom3/src/main/com/wsscode/pathom3/connect/operation.cljc:53:1
----- Context ------------------------------------------------------------------
49: ; endregion
50:
51: ; region records
52:
53: (defrecord Resolver [config resolve]
^--- No implementation of method: :getName of protocol: #'sci.impl.vars/HasName found for class: nil
54: pop/IOperation
55: (-operation-config [_] config)
56: (-operation-type [_] ::operation-type-resolver)
57:
58: pop/IResolver
----- Stack trace --------------------------------------------------------------
com.wsscode.pathom3.connect.operation - /Users/wilkerlucio/Development/pathom3/src/main/com/wsscode/pathom3/connect/operation.cljc:53:1
E.g. this works:
$ ./bb -e '(ns p) (defprotocol Foo (foo [_])) (ns r (:require p)) (defrecord Bar [x] p/Foo (foo [this] x)) (p/foo (->Bar 1))'
1
working on the repro
got it:
(ns pathom
(:require [babashka.deps :as deps]))
(deps/add-deps
'{:deps {borkdude/spartan.spec {:git/url ""
:sha "ef1fd1564d559dd446b3c11a35674eb9531e73b2"}
com.wsscode/cljc-misc {:git/url ""
:sha "bd48f6d1643a76db0d7046b5a007dfe77850e3db"}
com.wsscode/pathom3 {:git/url ""
:sha "d0ef2f59dd9a83ddb4130cb7898926670ce89be9"}
com.fulcrologic/guardrails {:git/url ""
:sha "b777e4244f9b608d5f4de0d74296ce3bb1ed732c"}}})
;; Loading spartan.spec will create a namespace clojure.spec.alpha for compatibility:
(require 'spartan.spec)
(alias 's 'clojure.spec.alpha)
; Expound expects some vars to be there, like `with-gen`. Spartan prints warnings that these are used, but doesn't implement them yet.
(require '[com.wsscode.pathom3.connect.operation :as pco])
ok, got it simpler
its about trying to extend clojure.lang.IFn
(ns repro
(:require [babashka.deps :as deps]))
(defrecord FnExtender
clojure.lang.IFn
(invoke [_this] nil)
(invoke [_this input] nil)
(invoke [_this env input] nil))
This is a nasty edge case in babashka: reify works on protocols OR classes, but not both at the same time. This is a limitation related to not being able to define new classes in a graalvm native image
gotcha, gonna try to ignore the FN extension at definition on babashka
this is not required for pathom to work, is more a user convenience
just got my first pathom output in babashka! 😄 🎉
just the defresolver
macro still doesn't work
when I try to use that, I get:
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: Parameter declaration missing.
Phase: analysis
ok, one moment
(ns pathom
(:require [babashka.deps :as deps]))
(deps/add-deps
'{:deps {borkdude/spartan.spec {:git/url ""
:sha "ef1fd1564d559dd446b3c11a35674eb9531e73b2"}
com.wsscode/cljc-misc {:git/url ""
:sha "bd48f6d1643a76db0d7046b5a007dfe77850e3db"}
com.wsscode/pathom3 {:git/url ""
:sha "ef871acc1e3302f95aae404369d0fdd50ccd9b63"}
com.fulcrologic/guardrails {:git/url ""
:sha "b777e4244f9b608d5f4de0d74296ce3bb1ed732c"}}})
;; Loading spartan.spec will create a namespace clojure.spec.alpha for compatibility:
(require 'spartan.spec)
(alias 's 'clojure.spec.alpha)
; Expound expects some vars to be there, like `with-gen`. Spartan prints warnings that these are used, but doesn't implement them yet.
(require '[com.wsscode.pathom3.connect.operation :as pco])
(pco/defresolver foo [] {})
Can you maybe look at the macro expansion of this, to see if there's anything weird?
I'm guessing now its about a unform
usage inside of it
and parameter declaration missing makes sense to me in this case
because the args parts are coming from unform
you think its an easy one to get in?
I'm taking a look, its seems mostly about having that interface implemented for different types from spec
I think so. We just need to add :unform
to all the specs and copy it from spec.alpha proper
cool, but no big priority on it, for me at least, I can make my thing work easely without that 🙂
but thinking here, would be cool and better to have that, more reach, I was looking in spartan code, not sure how to add the unform, if you can kick it out, I can fill in the implementation for others, should I open an issue for that?
please do. just check all the places where :cform
occurs, we should add something like :unform
there. Instead of reify
spartan.spec just uses maps to implement all the spec stuff
gotcha 👍
I'm working on it now
user=> (def mm (defmulti foo identity))
#'user/mm
user=> @mm
#object[clojure.lang.MultiFn 0x27b000f7 "clojure.lang.MultiFn@27b000f7"]
user=> (.dispatchFn @mm)
#object[clojure.core$identity 0xde88ac6 "clojure.core$identity@de88ac6"]
@wilkerlucio I merged
cool! with that my defresolver
works without changes 🙂
here is some code affected by this whole process we are doing here 🙂 - https://github.com/fulcrologic/guardrails/pull/21 - https://github.com/wilkerlucio/pathom3/pull/19 - https://github.com/wilkerlucio/cljc-misc/pull/1/files
Cool! I left a few remarks, some of them should not be necessary anymore on bb master
fixed that one 👍
@wilkerlucio Do you remember why we were talking about dispatch-fn
?
sorry, I don't remember the context
this is the next I found 🙂
----- Error --------------------------------------------------------------------
Type: java.lang.IllegalArgumentException
Message: No implementation of method: :getName of protocol: #'sci.impl.vars/HasName found for class: nil
Location: /Users/wilkerlucio/Development/pathom3/src/main/com/wsscode/pathom3/connect/operation.cljc:53:1
----- Context ------------------------------------------------------------------
49: ; endregion
50:
51: ; region records
52:
53: (defrecord Resolver [config resolve]
^--- No implementation of method: :getName of protocol: #'sci.impl.vars/HasName found for class: nil
54: pop/IOperation
55: (-operation-config [_] config)
56: (-operation-type [_] ::operation-type-resolver)
57:
58: pop/IResolver
----- Stack trace --------------------------------------------------------------
com.wsscode.pathom3.connect.operation - /Users/wilkerlucio/Development/pathom3/src/main/com/wsscode/pathom3/connect/operation.cljc:53:1
nice! is there gonna be a video available of the talk?
cool, and how was it? had fun doing it?
It's always a bit weird to speak before non-Clojure community about Clojure, but I think it went well