babashka-sci-dev

Crispin 2022-02-16T09:38:32.927389Z

👋

Crispin 2022-02-16T09:40:19.005269Z

Doing the pod work on spire and there's an interesting little difference that I'm not sure of how best to tackle. When the script is run under sci, inside spire, I naughtily deref sci.impl.vars/current-file to get a string representation of the present file being processed by sci.

Crispin 2022-02-16T09:41:01.479439Z

On the pod side (that is the clojure code I send to the pod with the describe step to be evaluated by bb) I rewrite this function to use *file*

Crispin 2022-02-16T09:42:21.843709Z

the difference is sci.impl.vars/current-file gives me a relative path. And *file* gives me a full path (like clojure does). Is there a sneaky way to get a relative path of the currently executing bb file?

borkdude 2022-02-16T09:49:53.689389Z

You naughty boy! :). I think a less naughty way of doing this would be to use sci.core/file

borkdude 2022-02-16T09:51:05.047309Z

if the behavior is different than JVM Clojure, then I consider that a bug. please report using a repro it so we can fix it

borkdude 2022-02-16T09:53:59.855099Z

@retrogradeorbit but thinking more about it, I don't think SCI binds the value of file itself, this is always done by the environment using SCI, so you should probably take care of this yourself?

Crispin 2022-02-16T10:11:28.275869Z

ah thats interesting. That would explain why its relative. I would be binding to that. It's been a while I looked in these guts...

Crispin 2022-02-16T10:12:06.736089Z

is sci.core/file available inside bb?

Crispin 2022-02-16T10:12:23.920859Z

I need something inside bb if there is one

borkdude 2022-02-16T10:12:47.802469Z

in bb this var is just *file*

borkdude 2022-02-16T10:13:44.916279Z

so in bb you would do it exactly like in clojure:

(binding [*file* ...] ...)
and outside of the env you would do it via SCI:
(sci/binding [sci/file ...] ...)

Crispin 2022-02-16T10:15:26.786549Z

yeah... I need that relative.

Crispin 2022-02-16T10:15:34.735769Z

maybe I just need to relativise it

Crispin 2022-02-16T10:16:29.929119Z

(it just needs to be relative for printing purposes...)

Crispin 2022-02-16T10:17:18.653469Z

yep I am binding to sci/file in my sci implementation

Crispin 2022-02-16T10:18:08.921319Z

and then I rebind in my load-file implementation.

borkdude 2022-02-16T10:19:14.760059Z

sounds good!