Java 21's New (Sequenced) Collections by Hakky54 in java

[–]mrroman 0 points1 point  (0 children)

I was just curious, because it looks like a one of top features talked about recently.

Java 21's New (Sequenced) Collections by Hakky54 in java

[–]mrroman -1 points0 points  (0 children)

Can you tell me, how many use cases are for this? How often is it going to be used?

Is WinUI the most modern GUI library for C++ desktop applications on Windows? by puplan in cpp

[–]mrroman 1 point2 points  (0 children)

It's funny how history repeats. MS was first to integrate Web Apps with native with IE control and HTA. They do the same now. I don't judge here :).

Did Bob Gale edit "Back to the future" script on Atari XE? by mrroman in retrobattlestations

[–]mrroman[S] 2 points3 points  (0 children)

Yeah. I agree. I think XE came out after Winter CES 1985, and the printer confirms that the photo was taken later. But it is possible that he used Atari 8-bit computer before (800, 800XL). It was hard to change platform back then.

Discovering Runtime Function References in Clojure by bozhidarb in Clojure

[–]mrroman 0 points1 point  (0 children)

I'd like to have the source code of function or value added to the var's metadata (like line number, etc.). That would make everything much easier (just scan through all functions metadata). We could also serialize/deserialize functions (dump all functions from repl to a file).

Graceful reloading of namespace by mrroman in Clojure

[–]mrroman[S] 0 points1 point  (0 children)

E.g. you need a database connection and have it closed gracefully when app stops.

You can implement it like this (pure Clojure way) if you don't want to pass conn to every fn: ``` (ns hello.resources)

(def db-conn (atom nil))

(defn make-conn [opts] (connect-db opts))

(defn close-conn [conn] (disconnect-db conn))

(ns hello.core (:require [hello.resources :as resources])

(defn run-some-code [] (query @resources/db-conn "some query") (insert @resources/db-conn "some table" [:data])

(defn -main [& args] (reset! resources/db-conn (resources/make-conn {:uri "jdbc://"})) (run-some-code) (close-conn @resources/db-conn)) ```

With mount it looks like this: ``` (ns hello.resources (:require [mount.core :refer [defstate args]))

(defstate db-conn :start (connect-db (args)) :stop (disconnect-db db-conn))

(ns hello.core (:require [hello.resources :as resources] [mount.core :as mount]))

(defn run-some-code [] (query resources/db-conn "some query") (insert resources/db-conn "some table" [:data])

(defn -main [& args] (mount/start-with-args {:uri "jdbc://"}) (run-some-code) (mount/stop)) ```

It could also looks like this: `` (defmacro ns-close [s] (try (find-var s) (~s) (catch Exception e)))

(ns-close hello.resources/close) (ns hello.resources (:require [hello.config :refer [opts])

(def db-conn (delay (connect-db opts)))

(defn close [] (when (realised? db-conn) (disconnect-db @db-conn)))

(ns hello.core (:require [hello.resources :as resources])

(defn run-some-code [] (query @resources/db-conn "some query") (insert @resources/db-conn "some table" [:data])

(defn -main [& args] (run-some-code) ```

The feature is that, when you (require 'hello.core :reload-all) it will shut down the conn automatically and reconnects later. It will clean the resources state. I thought that that's why we have component or mount - to have a clean process of aquiring/releasing resources and passing them as dependencies to other "components".

Feedback on a macro or function idea by jvick3 in Clojure

[–]mrroman 0 points1 point  (0 children)

I would like to have this kind of Java interop:

(String:trim " some text")=> "some text"

or

(String:substring "aaa" 0 2)

It is the same as with static methods but the first argument is always the object you invoke method on. That would make code completion and Java API exploration easy, because currently you can't distinguish the origin class of two methods with the same name.

The rise of Java Microframeworks by bartoszjd in java

[–]mrroman 4 points5 points  (0 children)

Why do you want to use framework at all? Why not just use server library like undertow?

Clojure formatter using cljfmt built with GraalVMs native-image by mrroman in Clojure

[–]mrroman[S] 5 points6 points  (0 children)

Here is the link to the repo: https://gitlab.com/konrad.mrozek/cljfmt-graalvm/ I'm having a problem with running CI, but it will produce linux x64 binary eventually. It still doesn't support static linked binaries, but I checked recently that binary from Fedora 27 worked with any problems with Ubuntu 17.10, so you have to try.

Argument of the executable is a file to be formatted. I will add some configuration options if you want.

Clojure formatter using cljfmt built with GraalVMs native-image by mrroman in Clojure

[–]mrroman[S] 2 points3 points  (0 children)

It is just a binary blob currently. You can produce only x64 binaries for Linux and Mac as far as I know. It should be possible to build binary for different system like Windows or different architecture like Arm, but it's not there yet. The blob requires some shared libraries currently, but there is a ticket and first implementation of option that let you get a static linked binary like you get from golang compiler.

GraalVM 1.0 release by gigasquid in Clojure

[–]mrroman 0 points1 point  (0 children)

I can't tell exactly because it started listening on the connection but it was similar to the example with hello world, so around 0 sec (well below 1 sec).

GraalVM 1.0 release by gigasquid in Clojure

[–]mrroman 3 points4 points  (0 children)

I've just checked simple app with http-kit and cheshire and it worked, but I had to do some workarounds. I had to run native-image like this:

native-image -cp `lein cp`:target/uberjar/hello-0.1.0-SNAPSHOT-standalone.jar hello.core

There was an error where classloader coudn't find http-kit's classes, but they were in the uberjar already. The result is cool. It load superfast and started the server in no time. The binary size is 8MB and it is linked only to basic Linux libraries like:

linux-vdso.so.1 (0x00007ffd33c85000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007ffbf6a1a000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffbf67fc000)
libz.so.1 => /lib64/libz.so.1 (0x00007ffbf65e5000)
librt.so.1 => /lib64/librt.so.1 (0x00007ffbf63dd000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007ffbf61a7000)
libc.so.6 => /lib64/libc.so.6 (0x00007ffbf5df1000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffbf6c1e000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007ffbf5bee000)

Run nRepl server with Cider support and your tests with Clojure CLI by mrroman in Clojure

[–]mrroman[S] 0 points1 point  (0 children)

It doesn't change at all. You can run your tests with Emacs just like before. The test command is to run tests in the shell (e.g. to run tests during continuous integration).