i.am.corpix
2020-5-29 10:07:19

@i.am.corpix has joined the channel


marc.kaufmannmk
2020-5-29 13:04:55

I seem to have managed to botch my install of racket, as I get the error when running racket on the command line: Welcome to Racket v7.7 [cs]. standard-module-name-resolver: collection not found for module path: (lib “racket/init”) collection: “racket” in collection directories: /home/marc/.racket/7.7/collects /usr/share/racket/collects/ … [12 additional linked and package directories]


marc.kaufmannmk
2020-5-29 13:06:17

The installation did work, but somehow today it suddenly kept giving this error message, as well as the following context:


marc.kaufmannmk
2020-5-29 13:06:18

context…: show-collection-err standard-module-name-resolver module-path-index-resolve [repeats 1 more time] module-declared? namespace-require+ thunk_10 call-in-empty-metacontinuation-frame call-with-empty-metacontinuation-frame-for-swap


marc.kaufmannmk
2020-5-29 13:07:19

The first time I saw the message was in Emacs, using Racket mode (to which I am trying to switch as of one/two weeks ago).


marc.kaufmannmk
2020-5-29 13:11:11

I can’t run the REPL or raco or any racket anything, not with sudo or otherwise. Any idea what might have happened to make a previously working install blow up like that? My sense was that it started going wrong while editing code in Emacs - but I am saying this only because for the first 10 minutes I did not see the error message, and then it started popping up all the time, with me thinking that it was a problem with my emacs config.


marc.kaufmannmk
2020-5-29 13:21:47

OK, solved it by reinstalling. I think the issue was that I had manually installed racket after uninstalling the ubuntu-ppa package. But I hadn’t purged the old ubuntu package. Then yesterday I removed some old packages - and Ubuntu helpfully deleted some (but not all) of the directories it associated with the old racket package. Suddenly things stopped working.


soegaard2
2020-5-29 13:30:07

Nice feature in the numpy manual. There is a link to the source on Github - it even links to the correct line.



soegaard2
2020-5-29 13:31:16

It ought to be possible with Scribble based docs too.


evyatar2013
2020-5-29 13:34:19

^as a novice racketeer (correct term?), this is a feature I wish the docs had.

Its not too cumbersome to find the package on github and search for the identifier, but saving a few clicks is always appreciated




spdegabrielle
2020-5-29 13:40:08

have you logged it as a FR against racket/scribble ?


soegaard2
2020-5-29 13:40:34

No. Go ahead :wink:


soegaard2
2020-5-29 13:40:59

I was sort of hoping something similar already existed.


spdegabrielle
2020-5-29 13:42:00

nope


spdegabrielle
2020-5-29 13:42:26

the scribble manual includes a link at the top, but nothing automated https://docs.racket-lang.org/scribble/index.html


spdegabrielle
2020-5-29 13:42:49

some package authors have started to do it too.


samth
2020-5-29 13:54:51

The next release will have links to the source.


samth
2020-5-29 13:55:51

spdegabrielle
2020-5-29 13:57:09

nice


soegaard2
2020-5-29 13:57:23

That’s great - but that’s the source of the documentation. The numpy docs for, say, the function eig links directly to the source code of eig.


spdegabrielle
2020-5-29 13:57:31

include section subverts it



samth
2020-5-29 13:58:17

Indeed; if you look at the discussion around the PR and issue it talks about that issue.


samth
2020-5-29 13:59:17

@soegaard2 I think it would be relatively easy to use similar techniques to link to the appropriate file.


soegaard2
2020-5-29 14:00:40

spdegabrielle
2020-5-29 14:01:12

ha that was me


samth
2020-5-29 14:02:27

in particular, the defproc code will know the defining file, and the code for the section should know the package that the module is in. From that, you can do the same thing that I did there.


soegaard2
2020-5-29 14:15:28

samth
2020-5-29 14:15:48

yes, but that was because the necessary info was already there


samth
2020-5-29 14:15:52

in the HTML


soegaard2
2020-5-29 14:16:02

Got it.


greg
2020-5-29 14:20:04

A link to the documentation source sounds awesome! Especially if y’all will be comfortable with “casual” PRs — e.g. someone clones the repo on GitHub only, makes the edit on GitHub only, and doesn’t build or run tests locally. Instead they just rely on CI for the PR. That way, it amounts to a sort of “edit-this-documentation UI by other means”.


spdegabrielle
2020-5-29 14:23:29

yes. it relies on reviewers who will do this and check.


samth
2020-5-29 14:25:51

Yes, that’s definitely one of the goals.


greg
2020-5-29 14:26:17

As for link to the source of the thing-being-documented (the “real” source code): I think this is nice, too.

My guess is the UX won’t be quite as nice as languages where this has been there from the start, and/or that don’t have real module systems, etc.

I say that from visiting definitions a lot in Racket Mode, to exercise that feature. My impression is that the immediate definition is useful/interesting less often in Racket, than in (say) Clojure or Emacs Lisp. Because more often the Racket definition is just a little layer of indirection, or was created by a macro, etc.

But even if it might be less satisfying, it will still be good to have, too!


samth
2020-5-29 14:27:23

I think there’s not much prospect for links directly to the definition from the documentation in the near term.


samth
2020-5-29 14:28:13

Linking to the source file is relatively easy, since that information is in the binding.


spdegabrielle
2020-5-29 14:28:22

I’ll admit I don’t know off hand how to do this effectively. I have done some flyby, and build my own code. I’m assuming I need to switch branches to the pr branch, build and test, then switch back to whatever I was doing. Takes me 52 minutes to compile so I’m assuming there is a shortcut I can take?


samth
2020-5-29 14:29:09

But as you know, the binding doesn’t have the source line information.


samth
2020-5-29 14:30:27

So you’d need to go and expand the defining file during the documentation build, which seems expensive and maybe not the right approach.


samth
2020-5-29 14:31:13

@spdegabrielle it doesn’t take me that long to rebuild when there’s just a doc change


greg
2020-5-29 14:31:58

Yeah there’s currently a kind of “last mile” problem.


spdegabrielle
2020-5-29 14:32:11

I’ll admit I use the search source functions in DrR and github,


greg
2020-5-29 14:32:39

spdegabrielle
2020-5-29 14:32:52

thought I was doing something wrong. :disappointed:


samth
2020-5-29 14:33:20

if you expand the file drracket will find the definition


spdegabrielle
2020-5-29 14:33:58

expand?


greg
2020-5-29 14:36:06

If you open the defining file in Dr Racket, and run Check Syntax (or it runs automatically), then you can visit the specific position of the definition.


greg
2020-5-29 14:36:48

The underlying drracket/check-syntax module knows how to find bindings that are defined in your module, their position.


greg
2020-5-29 14:37:03

I think is what Sam means here.


spdegabrielle
2020-5-29 14:38:36

right-click ‘open defining file’


greg
2020-5-29 14:39:40

Then if you somehow move the cursor to some usage of the thing (reference), Dr Racket’s jump to definition will take you to the definition.


spdegabrielle
2020-5-29 14:39:51

tried it on send


greg
2020-5-29 14:39:54

So you can do it, it’s just 2 or 3 steps.


samth
2020-5-29 14:40:10

or if the file is open and already expanded in the background, you can “go to definition (in other file)” in one step


greg
2020-5-29 14:40:53

I didn’t know that. That’s good.


spdegabrielle
2020-5-29 14:41:10

yup


spdegabrielle
2020-5-29 14:42:04

This is better than linking to the source on g*hub/lab


greg
2020-5-29 14:42:19

So the view from orbit is, identifier-binding will (usually) tell you the file in which something is defined. Then the expanded syntax needs to be walked. Using drracket/check-syntax for this is probably the easiest way to do this.


spdegabrielle
2020-5-29 14:43:35

and racket mode does the same thing via find-def-in-file ?


greg
2020-5-29 14:43:37

(The longer story is there are edge cases where this doesn’t work. Like chaperones, provides that both rename and add a contract. Then you do the other stuff I did in that file I linked to, if you’re stubborn. :smile: But you probably don’t need to, certainly not for version 1.)


greg
2020-5-29 14:44:02

The view from orbit description is usually true.


samth
2020-5-29 14:44:49

I think linking to the source is valuable, and having go-to definition in the IDE is also valuable.


greg
2020-5-29 14:46:01

Yes so do I. I’m just saying it’s easy to make it work (say) 90% of the time. Another 9% is trickier. And 1% is AFAIK impossible.


samth
2020-5-29 14:46:31

Well, for some things it’s not obvious there’s a right answer at all


greg
2020-5-29 14:46:42

Having visit-def work from Racket docs online, 90% of the time, would be a nice first step.


samth
2020-5-29 14:46:49

Like, where is the doc export from a scribble module?


spdegabrielle
2020-5-29 14:48:35

in the meant time I need a) to review someone else’s PR of a docs change and build it locally. (and write down the git commands so I don’t forget)


spdegabrielle
2020-5-29 14:50:11

(and yes I’ve been lazy and used git like svn)


spdegabrielle
2020-5-29 14:50:36

(we don’t use source control at work!)


greg
2020-5-29 14:50:46

@spdegabrielle I hope my TL;DR was clear. Don’t expect to it work perfectly. But it doesn’t need to. Even if it works only 90% cases, that’s more than the 0% we have now! So I’m trying to encourage not discourage you, really. :smile:


spdegabrielle
2020-5-29 14:51:51

thank you - yes it took is as encouragement with a dose of realism :slightly_smiling_face:


spdegabrielle
2020-5-29 15:26:51

(updated) in the meantime I need to a) review someone else’s PR of a docs change and build it locally. (and write down the git commands so I don’t forget)

to add the ability to link from the docs to the defining file in the source, b)  defproc code will know the defining file, and the code for the section should know the package that the module is in alternative: use identifier-binding to get the file (‘Linking to the source file is relatively easy, since that information is in the binding’) to add the ability to link from the docs to the DEFINITION in the defining file in the source, c) find the line/col with  drracket/check-syntax  or use find-def-in-file https://github.com/greghendershott/racket-mode/blob/master/racket/find.rkt#L120 NB see code in https://github.com/racket/scribble/pull/229/files


spdegabrielle
2020-5-29 15:57:05

mflatt
2020-5-29 17:38:23

Most of the MZCONFIG…s for the reader disappeared when the expander and reader moved from C to Racket. I’ll make a note to update the docs.


massung
2020-5-29 17:57:25

Just noting this was something I wanted to do as well (from Racket, not the C API) with eval.

Something that doesn’t exist (that I know of), but would be great, would be functions like:

(eval-with-lang lang s) scheme_eval_string_with_lang(lang, s);

My 2p.


samth
2020-5-29 18:19:04

Can you call scheme_eval_string("(read-accept-lang #t)") or similar first?


soegaard2
2020-5-29 18:38:19

Is it not necessary to call read-language explicitly?


samth
2020-5-29 21:16:43

that file prints 42 for me


samth
2020-5-29 21:17:02

is that what you see?


samdphillips
2020-5-29 23:22:42

With RacketCS embedded, is there a “simple” example of how to pass a foreign pointer into a call from C?

Currently I have: /* C */ ptr rkt_init_name = Sstring_to_symbol("racket-init"); ptr rkt_init = racket_dynamic_require(mod_name, rkt_init_name); Scall1(rkt_init, p_application); ;;; Racket (define (racket-init init-opts) (displayln init-opts)) Of course this fails.


mflatt
2020-5-29 23:58:15

Example of evaluating “#lang ….” from C with Racket BC.


mflatt
2020-5-30 00:00:40

I doubt that I have enough context to see the real problem, but beware that p_application is not valid after racket_dynamic_require returns.


samdphillips
2020-5-30 00:09:21

Thanks, that’s useful to know. I think it may be a problem with my procedure argument to Scall1 now.


samdphillips
2020-5-30 00:10:00

The error I’m getting is invalid memory reference


samdphillips
2020-5-30 00:10:10

And then a crash


samdphillips
2020-5-30 00:19:01

racket_dynamic_require returns a list. Using the result with racket_apply gave me some more error context.


samdphillips
2020-5-30 00:23:30

Yeah that’s what broke it.


michaelrauh
2020-5-30 02:40:44

@michaelrauh has joined the channel