Fork me on GitHub
#sci
<
2023-11-24
>
Ingy döt Net16:11:02

Is there something like *sci-version* ?

Ingy döt Net16:11:22

I'm having issues with the new sci release that I've included in my build and I thought it would be useful to show empirically which SCI is being used.

Ingy döt Net16:11:58

Seems like it would be nice in bb too

borkdude16:11:01

it might be present in *clojure-version*

Ingy döt Net16:11:22

well not from bb

borkdude16:11:50

you can obtain the SCI version using (slurp (io/resource "SCI_VERSION"))

borkdude16:11:57

in your host

Ingy döt Net16:11:16

bb repl gives

user=> (slurp (io/resource "SCI_VERSION"))
(slurp (io/resource "SCI_VERSION"))
java.lang.IllegalArgumentException: Cannot open <nil> as a Reader. [at <repl>:2:1]

borkdude16:11:24

in your host

Ingy döt Net16:11:38

not sure what that means then

borkdude16:11:51

not in the SCI program but outside of the SCI program

borkdude16:11:00

it's part of the SCI library

Ingy döt Net16:11:59

I see, so I could make my own *sci-version* is what you are implying?

Ingy döt Net16:11:20

will do. I think this would be useful when reporting SCI issues...

borkdude16:11:56

most of the time I use SCI as a git dependency so it's not as useful in that case

borkdude16:11:20

just tag your releases so people can find out what deps.edn you're using in the version they use

Ingy döt Net16:11:27

well at this point I would be reporting issues with current local builds

borkdude16:11:59

makes sense

borkdude16:11:27

I've also got an option in bb called: bb describe which prints a map with dependencies used

borkdude16:11:36

or rather, what features are used

borkdude16:11:43

and bb print-deps prints dependencies used

🙌 1
borkdude16:11:57

but SCI isn't in there I think

borkdude16:11:07

maybe it should be in there though

borkdude16:11:21

since SCI itself is also exposed in bb

borkdude16:11:32

anyway, this is something you could do as well

Ingy döt Net16:11:48

(I'm having an issue with the latest sci, and anticipating you wanting to see I really am using a specific version...)

Ingy döt Net16:11:02

I will add those to my todo!

borkdude16:11:37

it would be useful if you could use deps.edn in this case, even if only for running a development version so you can find out what commit caused the issue for you

borkdude16:11:40

what SCI commit

borkdude16:11:46

I use both lein and deps.edn in bb

borkdude16:11:50

deps.edn for development

Ingy döt Net16:11:12

well I generate a deps.edn using your thinger

borkdude16:11:19

oh yeah haha

🙂 1
Ingy döt Net16:11:04

I'm only using releases for deps (not git deps) at this point.

borkdude16:11:33

org.babashka/sci {:git/url " :git/sha "<commit-sha>"}

borkdude16:11:48

what kind of issue are you facing? perhaps it rings a bell

Ingy döt Net16:11:25

I'll mention it elsewhere in a few mins

Ingy döt Net16:11:39

$ ys -pC '*sci-version*'
{:major 0, :minor 8, :incremental 41}

👍 1
Ingy döt Net16:11:52

using

(def sci-version
  (sci/new-var '*sci-version*
    (->>
      (io/resource "SCI_VERSION")
      slurp
      str/trim-newline
      (#(str/split % #"\."))
      (map #(if (re-matches #"\d+" %) (parse-long %) %))
      (zipmap [:major :minor :incremental :qualifier]))))

👍 1
Ingy döt Net20:11:17

FWIW, I noticed these are not available in sci by default.

cast unquote-splicing update-keys update-vals
will those be added?

Ingy döt Net20:11:38

Many others too, but the others seemed very esoteric to me. TBH I've never use the 4 above, but they seemed possibly useful.

borkdude21:11:44

SCI should work with older versions of clojure so for now it's better if you add those manually

borkdude21:11:51

with sci/copy-var

Ingy döt Net21:11:04

aha, that makes sense

Ingy döt Net21:11:24

so they would work if added as far as you know?

borkdude21:11:55

unquote-splicing isn't really used in programs. I've never come across a program that used cast

Ingy döt Net21:11:44

I also noticed dosync but transactions is probably a big can of worms

borkdude21:11:13

check bb which has that

borkdude21:11:25

but most people never use it

Ingy döt Net21:11:56

sci is pretty amazing. was it a lot of work?

Ingy döt Net21:11:04

how long was it from conception to birth?

borkdude21:11:53

Well, it was quite useful already from the beginning but a lot has happened in the last 4 years to improve performance etc

Ingy döt Net21:11:10

lingy (my perl platform for clojure) would take a lot to get fully bootstrapped. but sci+graal makes getting yamlscript bootstrapped trivial. even though "trivial" is turning into 6+ months.

Ingy döt Net21:11:24

it's always the little things that slow me down... but the overall picture hasn't changed since when I learned about sci/graal in July

Ingy döt Net21:11:08

Every week I thought, I'll get it done this week. 😄 And I haven't taken barely a day off

😆 2