laurent.orseau
2021-3-31 09:10:39

I wish scribble was able to read-syntax a module file, extract the function headers and the contracts so that calling something like @defproc/auto[foo]{some text}) would generate the docs signature automatically


laurent.orseau
2021-3-31 09:22:21

srcdoc is good, but I want to put all the text and examples in a separate file, and is still verbose as it forces to repeat the argument names. It would be nice to use the function header’s ids automatically, with optional renaming.


laurent.orseau
2021-3-31 09:24:09

or a variant of srcdoc that exports the relevant information


laurent.orseau
2021-3-31 09:26:56

That suddenly sounds very doable :smile: I’ll write it down on my todolist, but that’s probably not going to reach the top before 2045


sorawee
2021-3-31 09:32:44

Wouldn’t work in general though, right?

For example, in https://github.com/racket/racket/pull/3743/files#diff-ebebe254faf92cfeb24f73f79e1568a1c7eeae72299e8a7cca28e57b6cccdbd5R577

how would you extract the information from inclusive-range?


laurent.orseau
2021-3-31 09:35:13

Obviously, for such cases you just revert to defproc


laurent.orseau
2021-3-31 09:38:35

Tackling forms is also usually more complicated/ad-hoc, so I would consider only autodoc for functions initially


thom
2021-3-31 10:35:51

@thom has joined the channel


sschwarzer
2021-3-31 10:45:29

It sounds as if it should be fine to use raco setup --only --pkgs <pkg-name> for speed most of the time during development, but use raco setup (and fix corresponding problems) before pushing changes. :slightly_smiling_face:


popa.bogdanp
2021-3-31 12:00:29

I was curious how hard this would be so I made a little prototype: https://gist.github.com/Bogdanp/ece1b1ed7204506ad38d94d8ea1d7d5b .

This seems to work, but I’m guessing it probably won’t work during package setup, because it won’t be able to resolve the paths (I think) and it’ll for sure fail for built packages.

Usage looks like:

@autodoc["test.rkt" foo] @autodoc["test.rkt" foo]{Some description.} @autodoc[some/mod bar]


laurent.orseau
2021-3-31 12:34:35

That’s awesome :smile:


laurent.orseau
2021-3-31 13:11:21

@popa.bogdanp It should work for built packages if the source file is present, no? At least this works for me: @autodoc[racket/string string-suffix?]


laurent.orseau
2021-3-31 13:12:43

Making progress: @autodoc[racket/string string-join]


popa.bogdanp
2021-3-31 13:13:26

> It should work for built packages if the source file is present, no? Yup


laurent.orseau
2021-3-31 13:13:31

(damnit, I’m not supposed to do that today!! :smile: )


popa.bogdanp
2021-3-31 13:13:36

Haha


popa.bogdanp
2021-3-31 13:14:11

I posted the snippet just as my workday started so it’s out of my hands now!


ivan.lapcha
2021-3-31 15:04:33

@ivan.lapcha has joined the channel


juan.carreon
2021-3-31 15:25:44

@juan.carreon has joined the channel


sschwarzer
2021-3-31 17:42:55

> damnit, I’m not supposed to do that today!! It’s called Racket addiction. :wink:


laurent.orseau
2021-3-31 18:06:57

Further progress:


laurent.orseau
2021-3-31 18:08:49

Unfortunately there are no explicit contracts in racket/string, only calls to raise-argument-error. But that’s okay since it’s meant for new libraries anyway. Also, ideally, it will be fully customizable, so as to do most of the work, but let the user tweak the remaining bits (and reverting to defproc in the worst case, with little effort)


sschwarzer
2021-3-31 20:19:48

I’m writing a summary of many of the things I learned from this channel (and will publish that on Github).

One thing just got me confused, though: From what I understood, a package can be re-installed with either $ raco pkg update -n <package-name> ../<working-dir> or $ raco setup <module-name> Are there situations when one is preferred over the other? (In any case, I can see the second version is shorter. :wink:)


sschwarzer
2021-3-31 20:30:04

> I posted the snippet just as my workday started so it’s out of my hands now! @popa.bogdanp Updates are welcome though. :wink: (as far as necessary)


wjb
2021-3-31 20:58:21

Yeah, that’s the consensus. Does anyone have a GHA or git push hook or something that will do this for you? I’m a big fan of not having to remember to do things.


robby
2021-3-31 21:14:42

The former one is an update and the latter is setup. Update is followed by a setup as part of that process.


robby
2021-3-31 21:15:00

Also, update is not really meaningful for packages that are installed in a directory


robby
2021-3-31 21:15:24

That’s more useful when the pkg source is elsewhere and you want to pull down the latest.


robby
2021-3-31 21:15:31

Not sure this is helping. :)


samth
2021-4-1 02:10:55

I would not ever use raco pkg update with a linked package, personally. The only thing you’re accomplishing with that is that it runs raco setup --pkgs <package-name>.


jesse697
2021-4-1 06:45:37

any idea how to cross-compile on CS? I’m running raco exe on an x86 Linux machine and would like to make a FreeBSD/x86 executable.


popa.bogdanp
2021-4-1 06:51:24

You’ll need to use a snapshot version of Racket and build that same version for FreeBSD (I’m not aware of any snapshots for FreeBSD) then see

https://www.cs.utah.edu/plt/snapshots/current/doc/raco/cross-system.html and • https://www.cs.utah.edu/plt/snapshots/current/doc/inside/ios-cross-compilation.html?q=inside (optional)


jesse697
2021-4-1 06:57:57

why is a snapshot version needed? is this some cutting-edge functionality? (In other words, if I wait till 8.1 is out, can I just work with 8.1 rather than snapshots?)


jesse697
2021-4-1 06:58:55

it makes me nervous to roll with snapshots in production :grimacing: