Fork me on GitHub
Adam Stokes12:09:12

I was looking at the dad source code and was curious; is this the right part of the code that allows you to set dad as your shebang line and parse whatever is after it? Im basically looking to do something similar

Adam Stokes12:09:41

I see it calls a reader implementation that has a few functions defined, it looks like those are what is exposed if you use dad as your shebang

Adam Stokes12:09:30

Also, when I was doing something similar in perl I used which basically allowed me to take functions from other libraries and import them into my "namespace" that would be automatically exported to the DSL

Adam Stokes12:09:36

I know babashka does this but it looks like you define those implementation files; do they just wrap the functions you want and pass on the args?


@adam.stokes This is not the dad channel and dad isn't something I developed, so I don't know, but perhaps the author is on Slack here somewhere

Adam Stokes13:09:02

Fair enough, in babashka, can you point me to the code that handles parsing the forms when using bb as your shebang

Adam Stokes13:09:27

Figured it was similar in nature since they both use sci


@adam.stokes A shebang is part of a shell implementation like bash, it just invokes a binary with that name

Adam Stokes13:09:10

From what I can tell you dont import the functions you want into your namsespace


and then that binary should decide how to deal with the arguments.

Adam Stokes13:09:34

Yep, that's the part im looking into

Adam Stokes13:09:50

does it just do some evaling on the remaining items when called from a script?


ok, in babashka this is pretty simple, it just uses slurp + SCI's eval-string*

Adam Stokes13:09:50

ok cool, was hoping it was something like that; and for exporting functions from other libraries to be used in this environment, is it just a matter of wrapping those functions in my own namespace?


see babashka.impl.main.clj


when you want to use other libraries in the SCI ctx, see the SCI docs

Adam Stokes13:09:34

Thanks will read up on that


The SCI docs are probably the best place to start with all of this


and then look at babashka etc. as examples

Adam Stokes13:09:07

Awesome, I'll take that approach, thanks again


@adam.stokes There's also a #sci channel for SCI questions, might you have any

🙏 2