This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-18
Channels
- # announcements (6)
- # babashka (16)
- # beginners (194)
- # calva (20)
- # cider (34)
- # clj-kondo (38)
- # clojure (89)
- # clojure-europe (10)
- # clojure-finland (15)
- # clojure-italy (2)
- # clojure-nl (15)
- # clojure-sg (7)
- # clojure-spec (15)
- # clojure-uk (86)
- # clojurebridge (1)
- # clojurescript (60)
- # community-development (11)
- # conjure (13)
- # core-async (48)
- # core-typed (3)
- # cursive (22)
- # datascript (8)
- # datomic (40)
- # duct (11)
- # emacs (3)
- # figwheel-main (22)
- # fulcro (45)
- # graphql (1)
- # helix (9)
- # hoplon (15)
- # hugsql (7)
- # jobs-discuss (47)
- # juxt (7)
- # kaocha (21)
- # luminus (1)
- # malli (13)
- # meander (2)
- # off-topic (52)
- # parinfer (19)
- # re-frame (66)
- # reagent (1)
- # reitit (3)
- # ring-swagger (1)
- # rum (2)
- # shadow-cljs (72)
- # spacemacs (5)
- # sql (4)
- # timbre (5)
- # tools-deps (15)
- # vim (5)
- # vrac (7)
in the fulcro-rad-demo readme it says - clj -A:dev:f3-dev:rad-dev:datomic
, however there is no alias named f3-dev
and rad-dev
in the deps.edn, maybe I am missing something, or is it just an old reference ?
please read more carefully https://github.com/fulcrologic/fulcro-rad-demo#running-from-source
@tony.kay Do you want to have a look at https://github.com/awkay/workspaces/pull/3 ?
Yes. It is already fixed
Well, that worked like a charm with the floating root with hooks from the multi-root-card example, @tony.kay 🙂
@zhuxun2 You said "If I were to write a function to retrive all root level keys given a EQL (which should have been trivial), the implementation would be a few lines unnecessarily longer since I need to consider those ref-type attributes."
I think EQL is not meant to be processed directly, maybe you can instead process the AST version of the EQL query
@myguidingstar I agree that you normally wouldn't do that in your app code, but what about tooling? In particular, editor plugins?
by AST, I mean EQL's AST that you get by calling (p/query->ast [:your {:eql [:query]})
, not Clojure syntax AST managed by Clojure reader
also: "If I am using Emacs to manually write a test example given an EQL, I am doing lots of unnecessary work changing brackets into braces and splicing sexp's."
I know what you meant. 🙂 My point is not that the current syntax is impossible to work with, but that it's not optimal and intuitive. Others confirmed that this was more due to historical incidence
maybe the helper function pc/data->shape
can help you with that?
My point was that the current syntax seems to be arbitrarily one of the sub-optimal syntaxes, and they chose this one mostly due to Datomic pull syntax
I'm just trying to find some workarounds for your pain points
Thanks for that 🙂 I am actually more trying to understand "why is it that way" rather than "how to fix it".
I can definitely work with the current syntax no problem, just a few more keystrokes and a bit more mind gymnastics which I will get used to anyway
I was just afraid that I missed something intrinsically nice about this syntax, and that's why they chose it, but I guess that's just not the case
I am familiar with the fact that underlying EQL, it's all represented interally as AST anyways and you could really use any facade for it
It's pretty easy to make this in fulcro I imagine. I don't see much use for the alternate syntax, but maybe I just haven't seen the killer example. If you want, you could write the parser and put that as a replacement hook in fulcro for local development.
@jatkin True. It's not something I would do though. As the value proposition is not large enough to break the community standard. I'm sure at this point the datomic pull syntax has burnt into the datomic/pathom/fulcro eco-system and I'm really just going to confuse whoever reads my code if I insist doing that
I do agree though - it is easier to read. Not drastically, but enough to see the difference. Mostly good for newcomers I imagine.
@jatkin But yes, maybe as a experiment I should write a plugin, see if people like it
I see. I don't find any of your arguments invalid 😄 I think Clojure community have two alternatives to EQL: Qlkit and D2Q
https://github.com/forward-blockchain/qlkit https://github.com/vvvvalvalval/d2q
On a side-note, my map syntax is not without its drawbacks. The fact that it's using a symbol "" as a val placeholder means that the whole query has to be quoted (which in most places in my app doesn't matter but I imagine it's annoying sometimes). I could use the number literal "1" instead but that's less clean. I could also have they symbol "" referrable in my library but it would make the plugin less friendly to use and prevent the user from using their own "_" symbol.
Since clojure doesn't have "t", a single digit number might be the literal with the smallest profile
I think a better idea, which might be more practically useful for current fulcro users is a little helper function called example->eql that turns an example of a possible return value into its corresponding eql
it's pc/data->shape
we can turn that into a eql
lib
and put it on "docs playground", both on fulcro docs and pathom docs
You could just have a :refer [_]
where (def _ nil || :ns-keyword/whatever)
is available.
Yes! That's what I meant when I said having the symbol "_" referrable :slightly_smiling_face:
The downside is of course you can't use it in any context where "" as been registered (like in a defsc where is bound to this, etc.)
Using my previous example. It works like
(example->eql
#:user{:id "xxx"
:name "aaa"
:email "bbb"
:projects #:project{:id #uuid "xxx"
:name ""
:start-date #inst "xxx"
:end-date #inst "yyy"
:comleted? true}
:contacts #:user{:id #uuid "xxx"}})
=>
[:user/id
:user/name
:user/email
{:user/projects [:project/id
:project/name
:project/start-date
:project/end-date
:project/completed?]}
{:user/contacts [:user/id]}]
This way, you get most of the structural benefits of the map syntax (sans the cleanliness of "_"), while being minimally confusing to your colleagues
Having the example structure in the :query field of defsc makes it just a bit easier to visualize e.g. what ":projects" looks like when sent in as a prop. Not much, but just enough to make me happier one defsc at a time 😄
That being said, you normally don't do nested EQL in your defsc. But still, visualizing the exact shape of [:user/id {:user/projects (comp/get-query ProjectItem)}]
has been a few seconds too long (and uncertain even after triple-checks) for a beginner like me