Fork me on GitHub
#clojure
<
2020-11-07
>
valerauko03:11:28

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?

alexmiller04:11:21

There is no reason to use a type hint there

valerauko04:11:02

How so? I added it to resolve a reflection warning

seancorfield06:11:39

Does it work if you put it before the parameter list instead of before the function name @UAEH11THP?

valerauko11:11:36

no, it reflects then

theophilusx05:11:48

@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.

👍 3
simongray10:11:53

Datafy, the protocol, is not defined as being recursive AFAIK, but is there some established, most efficient way to recursively datafy x?

simongray10:11:36

And what's a good name for such a function?

Nikolas Pafitis10:11:43

Hello guys, has anyone played around with Clojure + Graal's Truffle API at all?

delaguardo11:11:40

I'm using it in production for some time already. What is your question?

Nikolas Pafitis11:11:32

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

Nikolas Pafitis11:11:26

In your experience how feasible was it to use Truffle API with Clojure, what are some common gotchas?

Nikolas Pafitis11:11:46

I spend like 3 hours trying to get my interpreter to compile to a native-image but i managed after a while

Nikolas Pafitis11:11:19

Thanks in advance

Nikolas Pafitis11:11:09

Also i'm having difficulties integrating TruffleLanguage Annotations on my gen-classes

jmckitrick16:11:30

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.

Louis Kottmann19:11:29

The big advantages of gitlab for me is the easy self hosting, and the built-in CI

Louis Kottmann19:11:59

You just give it a runner docker image to run as the CI worker, and off you go

Louis Kottmann19:11:00

I have used many other alternatives (I am a DevOps and a clojurist) and this is it for me

jmckitrick16:11:20

When I say small, I mean just one dev, but this is professional project, not hobby or open source

dharrigan16:11:58

To self host?

dharrigan16:11:56

I self host gitlab from the omnibus-ce installation (super easy to setup), I also use and github

dharrigan16:11:21

Avoid bitbucket (Been burnt and continously being burnt) by Atlassian products

👍 3
jmckitrick16:11:56

I don’t see a need to self-host, but should I?

jmckitrick16:11:03

And what has gone wrong with BitBucket?

jmckitrick16:11:39

I should add, I totally hate Jira, though.

borkdude17:11:46

@jmckitrick My personal preference: github + circleci for CI

jmckitrick17:11:44

Hmm. Might be worth a shot, even though I get really annoyed with GH UI issues, lol. Heard good things about circleci.

borkdude17:11:09

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

dharrigan17:11:46

No need to self host if you don't need to, but I like to to keep some things just to myself

dharrigan17:11:42

Gitlab also offers runners that build projects (which also can run locally)

cdpjenkins18:11:57

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.

theophilusx22:11:05

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.