Fork me on GitHub
#clojure-spec
<
2018-09-15
>
richiardiandrea18:09:29

we have found that :: is a bit clunky for refactoring, is other people using the long :ns.foo.bar/quuz for specs?

mpenet18:09:02

Not really. You change the name just in the ns declaration vs everywhere you use it. I guess it s quite personal

richiardiandrea18:09:53

well you have to change the namespace and the alias in case it changes

mpenet18:09:18

Yes that's what I meant

richiardiandrea18:09:19

while with unqualified you don't have to do anything else, just copy them around

richiardiandrea18:09:47

I mean fully qualified 😄

richiardiandrea18:09:50

following along these lines, sometimes you need to make them unique...you cannot use :foo/bar or they would clash

mpenet18:09:07

The alias doesn't change really, just the thing it points to.

richiardiandrea18:09:03

this though means you need to give names

richiardiandrea18:09:16

and naming is hard and requirements change and all that

richiardiandrea18:09:02

so we found fully qualified better for us - for now... 😄

mpenet18:09:02

Same argument that's sometimes mentioned with clj.spec.alpha, just use aliases ex s/def and the day it changes to beta or whatever you just update the alias target

mpenet18:09:03

In the end it s just a search & replace with less/more hits, I guess both ways are fine

richiardiandrea18:09:41

well my argument would be that you don't even need search and replace

richiardiandrea18:09:51

at the price of spec verbosity

mpenet18:09:46

You d need to update every kw vs just ns declarations so yeah, there is some s&r :p

richiardiandrea18:09:11

my question was something else though.. 😄

richiardiandrea18:09:23

kind of a feature request, but at this point I don't know if it makes sense 😄

richiardiandrea18:09:49

it would be great if you could have aliases of keywords that are not tight to a namespace

alexmiller18:09:20

we do expect to have something like this, but not sure yet exactly what it will look like

alexmiller18:09:36

didn’t want to couple it tightly to existing namespace/alias support

richiardiandrea18:09:37

like (defkw :my-long.foo.bar :mfb)

richiardiandrea18:09:33

is there a JIRA to upvote? I can open one

mpenet18:09:53

Would be interesting if spec understood hierarchies, but I already mentioned that

alexmiller18:09:45

there is one I think

richiardiandrea18:09:16

will track it and write there if I have good ideas 😄

lilactown20:09:46

yeah I ended up writing the fully qualified keyword for my specs lately and really am glad I did

lilactown20:09:58

it made it really easy to e.g. move all of my specs to their own ns

dadair23:09:48

Does the thing change if it moves namespaces? Is it fundamentally different? If not, I think aliasing conflates location with name with regards to specs. I tend to prefer something like :transport/event because what it is doesn’t change based on where it is.