clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
valerauko 2020-11-07T03:02:28.195700Z

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?

alexmiller 2020-11-07T04:13:21.196300Z

There is no reason to use a type hint there

valerauko 2020-11-07T11:38:36.213800Z

no, it reflects then

valerauko 2020-11-07T04:42:02.196800Z

How so? I added it to resolve a reflection warning

2020-11-07T05:24:48.208Z

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

đź‘Ť 1
seancorfield 2020-11-07T06:04:39.208200Z

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

simongray 2020-11-07T10:05:53.211500Z

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

simongray 2020-11-07T10:06:36.211600Z

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

Nikolas Pafitis 2020-11-07T10:41:43.212500Z

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

2020-11-07T11:15:40.212600Z

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

Nikolas Pafitis 2020-11-07T11:17:32.212800Z

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 Pafitis 2020-11-07T11:18:26.213Z

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

Nikolas Pafitis 2020-11-07T11:18:46.213200Z

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

Nikolas Pafitis 2020-11-07T11:25:19.213400Z

Thanks in advance

Nikolas Pafitis 2020-11-07T11:32:09.213600Z

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

jmckitrick 2020-11-07T16:43:30.218100Z

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 Kottmann 2020-11-08T19:00:29.242600Z

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

Louis Kottmann 2020-11-08T19:00:59.242800Z

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

Louis Kottmann 2020-11-08T19:02:00.243Z

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

jmckitrick 2020-11-07T16:44:20.218800Z

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

dharrigan 2020-11-07T16:44:58.219100Z

To self host?

dharrigan 2020-11-07T16:45:56.220100Z

I self host gitlab from the omnibus-ce installation (super easy to setup), I also use <https://sourcehut.org/> and github

dharrigan 2020-11-07T16:46:21.220600Z

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

đź‘Ť 1
jmckitrick 2020-11-07T16:58:56.221100Z

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

jmckitrick 2020-11-07T16:59:03.221400Z

And what has gone wrong with BitBucket?

jmckitrick 2020-11-07T16:59:39.221700Z

I should add, I totally hate Jira, though.

borkdude 2020-11-07T17:04:46.222100Z

@jmckitrick My personal preference: github + circleci for CI

jmckitrick 2020-11-07T17:05:44.222800Z

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

borkdude 2020-11-07T17:07:09.223400Z

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

dharrigan 2020-11-07T17:34:46.223900Z

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

dharrigan 2020-11-07T17:36:42.224700Z

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

2020-11-07T18:02:57.226700Z

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.

2020-11-07T22:28:05.231600Z

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.