This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-07
Channels
- # announcements (2)
- # babashka (38)
- # beginners (38)
- # calva (4)
- # cider (1)
- # clj-kondo (43)
- # clojure (50)
- # clojure-dev (39)
- # clojure-europe (4)
- # clojure-spec (4)
- # clojure-uk (2)
- # conjure (6)
- # core-async (5)
- # core-typed (3)
- # data-science (2)
- # datomic (6)
- # depstar (4)
- # emacs (1)
- # events (2)
- # fulcro (4)
- # jobs-discuss (4)
- # luminus (1)
- # off-topic (5)
- # re-frame (14)
- # shadow-cljs (8)
- # sql (8)
- # tools-deps (22)
I'm having this weird problem with protocols. Having a protocol like this:
(ns something
(:import [very.long.class Thing]))
(defprotocol Something
(^Thing ->do-it [_]))
If I then require
this ->do-it
to another namespace, I get "Unable to resolve classname: Thing" errors. They can be resolved if I type hint with the fully qualified name of the class though. Is this expected/normal behavior?I'm experiencing the same issue of having to import Java classes when using type-hinted protocol functions. (Thank you for the workaround of using the fully qualified name). Did you figure out more about the issue? @alexmiller, why did you say that there isn't a reason for type-hinting the return value of a protocol function? Wouldn't it be for the same reasons as for a plain function?
where did I say that? I'm missing the context
Next message after @UAEH11THP's
If I understood correctly
geez, this is from 3 or 4 years ago
it depends on your goals here - I believe the interface generated for protocols always uses Object regardless of your type hint, but this type hint might be useful for type flow at point of use
It seems that the compiler is trying to resolve an unqualified type hint at the client namespace, not at the namespace that the protocol was defined in.
that problem has been fixed
that was https://clojure.atlassian.net/browse/CLJ-1180 fixed in Clojure 1.11.0
:thinking_face: Using 1.11.1 over here...
Seems to be part of 1.12 https://github.com/clojure/clojure/commit/8957a93099fc506c3b24ed5739bf9e2fc1811bef
I think you're misreading the github UI there, it is included in 1.11
it was committed for 1.11.0-beta1 and is in all subsequent releases (which does include 1.12 which is what you're seeing on the github ui)
Oh. I wonder then why I'm experiencing the issue on my side running 1.11.1...
I can't repro it with 1.11.1
if you have a small repro, happy to see it
I'll try with a new project... Thanks for looking at it Alex!
There is no reason to use a type hint there
Does it work if you put it before the parameter list instead of before the function name @UAEH11THP?
@matiasfh I did something similar for some work colleagues. What I did with the repl was demonstrate how you could use the repl to develop a simple client, making basic API requests to explore the remote API and from there define functions to query the API. This shows how you can build up things incrementally within the REPL i.e. write the code to make the request, get back the data, add code to process the data and finally add code to present the data. It also shows how you can use the REPL to explore an unfamiliar API and work out how different input values might affect things etc. The other thing you can do if you want to stick with just the web server example is use the repl to show how to develop some middleware component. You start with a basic middleware function which just takes the input and passes it through. Then you can start adding data transformations, showing how the middleware can be used to add/remove/change the data as it is passed in or out of the server. Has the advantage of showing how useful the REPL can be, plus makes the whole middleware concept a bit clearer. I also saw a demonstration of REPL based development which showed how powerful the repl can be when doing Java interop, allowing you to interact and query Java objects. A very useful technique when working with a Java library which might not have great documentation and you need to 'discover' more about the objects etc. I think it is important to also show how the Clojure REPL is more owerful than just having an interactive 'shell' i.e. how you can modify a running system without having to stop and restart it. The term REPL seems to be getting applied to the broader concept of an interactive 'shell', missing some of the more subtle differences of a 'traditional' lisp repl.
Datafy, the protocol, is not defined as being recursive AFAIK, but is there some established, most efficient way to recursively datafy x?
Hello guys, has anyone played around with Clojure + Graal's Truffle API at all?
I'm using it in production for some time already. What is your question?
So basically what i did so far was implement a DSL in Jetbrains MPS that generates the AST as edn or xml. I want to use the Truffle API to interpret said AST, and i wanted to try it out with Clojure, but i ended up with a mess of gen-classes
In your experience how feasible was it to use Truffle API with Clojure, what are some common gotchas?
I spend like 3 hours trying to get my interpreter to compile to a native-image but i managed after a while
Thanks in advance
Also i'm having difficulties integrating TruffleLanguage Annotations on my gen-classes
Any preference between GitLab and BitBucket for small Clojure projects? I guess the key points would be Clojure syntax highlighting and CI/CD that works with it as well, plus maybe a few things I haven’t thought of yet.
The big advantages of gitlab for me is the easy self hosting, and the built-in CI
You just give it a runner docker image to run as the CI worker, and off you go
I have used many other alternatives (I am a DevOps and a clojurist) and this is it for me
When I say small, I mean just one dev, but this is professional project, not hobby or open source
I self host gitlab from the omnibus-ce installation (super easy to setup), I also use
and github
I don’t see a need to self-host, but should I?
And what has gone wrong with BitBucket?
I should add, I totally hate Jira, though.
@jmckitrick My personal preference: github + circleci for CI
Hmm. Might be worth a shot, even though I get really annoyed with GH UI issues, lol. Heard good things about circleci.
I don't have a lot of experience with gitlab, might be worth a shot as well, I'm just happy enough with github to not switch for now
No need to self host if you don't need to, but I like to to keep some things just to myself
I use BitBucket at work - both BitBucket Cloud and also BitBucket Server (which used to be called Stash and which Atlassian are phasing out in the the next few years). They are less bad than other Atlassian software that we use but I’m not a fan of either.
It has been a few years since I used Bitbucket. When I did, it was fine, but really I just used it as a cloud hg/git repository. Have used gitLab recently and it is pretty good. It has many of the features of GitHub. Was using a self-hosted gitlab instance and found it had most of the functionality provided by github, but some of it is at a slightly lower level i.e. setting up custom workflows, actions etc takes a bit more work. For a simple small project with perhaps some CI, gitlab would be fine. I also still find github fine, but don't use the web UI much - mainly use magit, forge etc from emacs or just git CLI.
I'm experiencing the same issue of having to import Java classes when using type-hinted protocol functions. (Thank you for the workaround of using the fully qualified name). Did you figure out more about the issue? @alexmiller, why did you say that there isn't a reason for type-hinting the return value of a protocol function? Wouldn't it be for the same reasons as for a plain function?