Fork me on GitHub
#clojurescript
<
2018-08-02
>
jjttjj03:08:17

Was it once the case that you could extend a type to implement IFn with a variable length arity, as follows:

IFn
  (-invoke [this & args]
    (apply assoc this args))
but now you have to explicitly define all the arities? I'm seeing the above in a library but getting an error

jjttjj03:08:16

Actually I guess it's just a warning Protocol IFn implements method -invoke with variadic signature (&)

jjttjj03:08:46

found more info here for any future log readers: https://github.com/reagent-project/reagent/pull/303

dnolen13:08:40

@jjttjj variadic protocol signatures are not allowed

punit-naik13:08:48

Hi All. Can clojurescript port of hiccup be used alongside re-frame?

dnolen13:08:01

and not guaranteed to work

jjttjj13:08:40

gotcha, thanks!

dnolen13:08:43

it was never supported

dnolen13:08:57

protocols are designed to more or less follow Clojure sans some Java-isms

jsa-aerial14:08:13

Please excuse cross posting here, but #cljsjs seems to only be populated by PR messages...

jsa-aerial14:08:16

@juhoteperi I think you are the most likely to know this - I have now updated the packages for vega, vega-lite, vega-embed and vega-tooltip. These are all versions in support of the final release 3 of vega and release 2 of vega-lite. Newer are now dev rc versions.  10:24 AM @juhoteperi before I commit, should I remove the target directories? Second, should I make four separate commits or all updates in one?

jjttjj17:08:10

is (:require-macros my.lib.core) from within the my.lib.corecljs namespace so that macros can be implicitly :refer'd now considered idiomatic and generally worth doing when polishing up some library code?

thheller17:08:44

@jjttjj yes absolutely

👍 4
kasuko18:08:04

Hey guys, I am having an interesting issue. I am trying to write a macro and in that macro I need to create a namespaced keyword, but I want the keyword to be namespaced to the namespace in which the macro is evaluated, not where it is written? I have tried a bunch of things like trying to find the info in the &env or trying to abuse the ::key but no avail. Any thoughts?

darwin18:08:17

Hmm, I guess (:name (:ns &env)) should work (I didn’t test it)

kasuko19:08:03

Ya I saw that on stack overflow, but I couldn't get it to work

kasuko19:08:19

Let me add a bit of information

kasuko19:08:56

This is what I have that currently works, the (-> #'graphql-queries# meta :ns name) is what I am trying to do but that feels really hacky.

kasuko19:08:18

For reference the macro uses another macro (from a library) to gather .graphql files and parse them. Then I want to go through all the found queries and register a re-frame subscription for that query.

kasuko19:08:53

I want that re-frame subscription to register based off a namespaced key

kasuko19:08:42

This is how the macro should be used.

kasuko19:08:49

So then if in dog.graphql I define a query called GetDog I will have a re-frame subscription registered on the keyword :foobar.subs.dog/GetDog

kasuko19:08:13

If I use the proposed (:name (:ns &env)) solution I get the following when logging the namespace:

lilactown20:08:22

1. that is hella cool 2. following this thread with great interest 🙂

kasuko14:08:51

Was this in response to the namespace macro thing? Or the underlying subscription based GraphQL?

lilactown15:08:26

pulling in a .graphql file + exposing it as a subscription is really cool

kasuko15:08:26

Ya it's working out pretty well. I am developing it for my company, it does require some hoops to jump through to integrate Apollo Client into Clojurescript but that is all hidden behind a reagent atom that maps to the ApolloClient's ObserveableQuery. Let me know if you want more info.

lilactown15:08:49

yeah I actually did the same thing! we’re using just plain reagent though.

lilactown15:08:38

we wired up apollo-client to a function that returns a ratom, but components just declare their query in-line basically: (apollo/watch-query client "query { … }")

lilactown15:08:43

I like the idea of separating the queries out to .graphql files, it could allow for some other post-processing steps like validation and other things

thheller20:08:32

@kasuko instead of (-> #'graphql-queries# meta :ns name) you want the suggested ~(-> &env :ns :name)

kasuko14:08:45

It was defintiely the :name I even backed up to the :ns to ensure I wasn't missing something.

thheller20:08:33

the log looks like you only did (:ns &env) maybe?