mflatt
2020-4-29 11:52:10

Where is README.mdsupposed to come from? I don’t see it inpolyglot-lib/polyglot` in the GitHub repo — only in the root, which is outside of a package.


ben
2020-4-29 13:02:44

Help! I added one syntax-parse case to my program, and now running the program ends with: application: not a procedure; expected a procedure that can be applied to arguments given: #0=#0# Attached is a smaller program that gives the same error on my clone (I’ll try updating to the latest master) • on RacketCS 7.6, the attached program ends with application: not a procedure .... given #<undefined> • on RacketBC 7.6, it ends with module-path-index-join*: undefined; cannot reference an identifier before its definition in module: "/Users/ben/code/racket/fork/extra-pkgs/typed-racket/typed-racket-lib/typed-racket/small.rkt" context...: "/Users/ben/code/racket/fork/extra-pkgs/typed-racket/typed-racket-lib/typed-racket/small.rkt": [running body] temp35_0 for-loop run-module-instance! perform-require! Tiny changes to the attached program remove the error … things like (1) returning (void) instead of a syntax object, (2) removing a define , (3) replacing (if (not ....) #f ....) with (and .... ....)

EDIT: followup, the program has a use-before-def error that was sometimes hidden by the CS inliner


soegaard2
2020-4-29 13:04:13

@ben Which line is the syntax-parse clause you added ?


ben
2020-4-29 13:04:35

86


ben
2020-4-29 13:06:25

but I think the problem is something deeper than syntax-parse … its very strange that I can remove a define at the bottom of the file & “fix” things


soegaard2
2020-4-29 13:06:40

No idea.


ben
2020-4-29 13:07:07

thanks for taking a look


ben
2020-4-29 13:08:18

oh — were you able to run the program and get a similar error?


soegaard2
2020-4-29 13:09:36

I get: > ; module-path-index-join*: undefined; > ; cannot reference an identifier before its definition > ; in module: "/Users/soegaard/tmp/err.rkt" > ; Context: > ; "/Users/soegaard/tmp/err.rkt":1:1 [running body] > ; [Due to errors, REPL is just module language, requires, and stub definitions]


soegaard2
2020-4-29 13:09:51

7.5 bc


mflatt
2020-4-29 13:19:21

I may be confused… Shouldn’t the error always happen, since module-path-index-join* on line 586 is used before defined on line 593?


ben
2020-4-29 13:22:43

wow, that use-before-definition is a problem in the original program

but I didn’t see any error until I added that syntax-parse case


ben
2020-4-29 13:25:33

yeah, I made that mistake 2 weeks ago but didn’t see the error until today https://github.com/bennn/typed-racket/commit/a6557eb21


mflatt
2020-4-29 13:25:38

On Racket CS, it looks like the error doesn’t happen because Chez Scheme’s cp0 is insufficiently thwarted; it inlines module-path-index-join*, even though the definition is later.


ben
2020-4-29 13:26:01

ok, I’ve been using CS


mflatt
2020-4-29 13:27:11

Which version gave you the #0=#0# error (which would mean that a not-yet-initialized variable was accessed without a guard)?


ben
2020-4-29 13:27:19

should I open an issue with this program? I’ve had trouble making a smaller one … but I was focused on syntax-parse


ben
2020-4-29 13:29:03

I was on racket/racket 7f9784775f and racket/ChezScheme 778e6426bc


mflatt
2020-4-29 13:29:40

You don’t necessarily need to open an issue — I’ll work on it anyway — but here’s a small program: #lang racket (define f (let ([v (g)]) (lambda () v))) (define (g) 0)


ben
2020-4-29 13:30:21

(oh right, we don’t need a program that errors; only one that should error)


ben
2020-4-29 13:30:23

thank you!


mflatt
2020-4-29 13:33:09

Well, I’m not sure why the unsafe-undefined value would be exposed in that slightly older version, but I can see how things would generally go bad if cp0 is reordering evaluation.


mflatt
2020-4-29 14:49:40

The bug appears to be a simple schemify bug. It sometimes sets up cp0 with assumptions that are too optimistic, but in the 7-line program above, schemify is the layer performing the too-early inline.


deactivateduser60718
2020-4-29 15:07:03

So it only needs to be in -lib to be distributed?


mflatt
2020-4-29 15:14:30

Assuming that polyglot demo is looking for README.md in the polyglot collection, then yes: it needs to be in polyglot-lib/polyglot to be in the polyglot collection when polyglot-lib is installed.


deactivateduser60718
2020-4-29 15:14:48

Thanks.


greg
2020-4-29 16:06:05

@samth I made an issue for this, and tried to repro, but seem to need more info: https://github.com/greghendershott/racket-mode/issues/457


greg
2020-4-29 16:06:46

(I’d rather discuss there so I’ll have the history forever, as opposed to Slack scrolling it away under the free plan.)


spdegabrielle
2020-4-29 19:11:56

% git remote add fork <https://github.com/spdegabrielle/drracket.git> fatal: not a git repository (or any of the parent directories): .git any idea what I’m doing wrong here?


spdegabrielle
2020-4-29 19:12:22

I’ll admit i’m usually lazy and open from github desktop


samth
2020-4-29 19:12:52

you aren’t inside a git checkout


spdegabrielle
2020-4-29 19:14:27

spdegabrielle
2020-4-29 19:14:34

a pre-compiled version of Racket


samth
2020-4-29 19:17:45

you probably just need to cd &lt;PKG&gt;


spdegabrielle
2020-4-29 19:18:19

thank you


dstorrs
2020-4-29 19:52:43

I’ve got a module, ‘handy’, which consists of a couple dozen files (“hash.rkt”, “list-utils.rkt”, etc) and a “main.rkt” file which includes all of them and then does (provide (add-defined-out …)) for each one and I’m trying to document it. I’m trying to get something like the racket reference: https://docs.racket-lang.org/reference/index.html : A top level page consisting solely of the TOC which links to separate pages for each "<foo>.rkt" What I’m getting instead is that main.html has a TOC and then includes the text of the subfiles. Here’s the stripped-down version of main.scrbl ; can someone point me to the mistake?

lang scribble/manual

@title{handy} @author{David K. Storrs} @table-of-contents[] @include-section[“list-utils.scrbl”]


dstorrs
2020-4-29 19:53:49

list-utils.scrbl looks like this:

lang scribble/manual

@(require (for-label racket handy handy/list-utils) racket/sandbox scribble/example) @title{handy/list-utils} @author{David K. Storrs} @defmodule[handy/list-utils] @local-table-of-contents[] …500 lines of stuff…


sorawee
2020-4-29 19:59:34

@dstorrs you want to use (define scribblings '((&lt;your-main-scribble-file.scrbl&gt; (multi-page)))) in info.rkt


dstorrs
2020-4-29 20:01:51

Ah, okay.


dstorrs
2020-4-29 20:02:13

How do I then rebuild the documentation for the current directory without rebuilding everything?


dstorrs
2020-4-29 20:02:22

Until now I’ve been doing “scribble main.scrbl”


samth
2020-4-29 20:03:17

raco setup handy should do the trick


dstorrs
2020-4-29 20:03:33

I don’t see a ‘multi-page’ option in scribble —help


sorawee
2020-4-29 20:03:47

Wouldn’t that actually rebuild everything, including non-Scribble stuff?



samth
2020-4-29 20:05:08

@sorawee yes but you usually want to do that


sorawee
2020-4-29 20:07:28

When I was working on a new feature of Rosette, I had exactly this problem. I really don’t want to recompile the whole Rosette implementation. I only updated the documentation and only want to rebuild it.

Using scribble command directly is not ideal because it doesn’t link styles, etc correctly.


dstorrs
2020-4-29 20:07:30

Thanks, Sorawee. I blanked on that bit — I’ve honestly been RTFMing but it’s a lot to keep in my head.


dstorrs
2020-4-29 20:08:13

> Using scribble command directly is not ideal because it doesn’t link styles, etc correctly. Why not?


dstorrs
2020-4-29 20:08:31

The output looks styled like I expect…


sorawee
2020-4-29 20:10:56

Sorry, I should have been more clear: when I scribble directly instead of raco setup, the multi-page setting is not taken into account. Links to non-local forms are broken.


sorawee
2020-4-29 20:11:44

This is an output from scribble rosette-guide.scrbl


sorawee
2020-4-29 20:12:56

And this is the output from raco setup


sorawee
2020-4-29 20:13:28

Stuff like define-symbolic is linked correctly because it’s local


sorawee
2020-4-29 20:13:42

But identifiers like eq? are not


sorawee
2020-4-29 20:14:49

So usually, I do want to use raco setup more than scribble. But then raco setup will recompile everything, including non-Scribble files.


dstorrs
2020-4-29 20:20:31

nod


dstorrs
2020-4-29 20:23:36

Okay, next issue:

Among other stuff, I’ve got this in ~/projects/handy/info.rkt: (define scribblings '(("scribblings/main.scrbl" (multi-page)))) ~/projects/handy/scribblings/main.scrbl includes @include-section["list-utils.scrbl"] ~/projects/handy/scribblings/list-utils.scrbl exists When I do raco setup handy I get the following:

...stuff...


dstorrs
2020-4-29 20:23:41

raco setup: --- building documentation --- [16:19:35] raco setup: 3 running: &lt;pkgs&gt;/handy/scribblings/main.scrbl open-input-file: cannot open module file module path: /Users/dstorrs/projects/list-utils.rkt path: /Users/dstorrs/projects/list-utils.rkt


samth
2020-4-29 20:23:44

you can fix that with the +m flag and --htmls flag


dstorrs
2020-4-29 20:24:15

How do I make it look in the correct directory?


samth
2020-4-29 20:24:19

fix what @sorawee said, that is


sorawee
2020-4-29 20:25:31

@dstorrs looks like the path is wrong: it should be /Users/dstorrs/projects/handy/list-utils.rkt rather than /Users/dstorrs/projects/list-utils.rkt, right?


dstorrs
2020-4-29 20:25:44

Yes.


sorawee
2020-4-29 20:25:47

Would it help to cd to the correct directory first?


sorawee
2020-4-29 20:25:56

So that the current directory is correct?


sorawee
2020-4-29 20:26:03

Idk, just throwing random ideas


dstorrs
2020-4-29 20:26:06

I already am.


dstorrs
2020-4-29 20:26:15

[dstorrs@MacBook-Pro-2:~/projects/handy/scribblings:&lt;docs*&gt;]$ raco setup handy


samth
2020-4-29 20:26:24

Your problem is in a require


samth
2020-4-29 20:26:37

not include-section


sorawee
2020-4-29 20:27:26

Oh yup, that’s list-utils.rkt, not list-utils.scrbl


dstorrs
2020-4-29 20:30:53

Okay… These all work: $ racket ../main.rkt $ racket ../list-utils.rkt $ scribble main.scrbl $ scribble list-utils.scrbl


dstorrs
2020-4-29 20:31:10

Where should I be looking for the incorrect require?


sorawee
2020-4-29 20:33:21

I assume that in your list-utils.scrbl, there’s a require of list-utils.rkt


dstorrs
2020-4-29 20:33:49

I’m using the same @require line in main.scrbl and list-utils.scrbl. I’ve tried both: @(require (for-label racket "../main.rkt" "../list-utils.rkt") racket/sandbox scribble/example) and @(require (for-label racket handy handy/list-utils) racket/sandbox scribble/example)


dstorrs
2020-4-29 20:36:14

Hm. Maybe it was the examples. In list-utils.scrbl I have:

@(define-syntax-rule (hlu-eval label body ...) (examples #:label label #:eval ((make-eval-factory '("../list-utils.rkt" racket))) body ...)) That is the correct path from list-utils.scrbl to list-utils.rkt, and cwd is alongside the .scrbl so it’s correct wrt that as well.


dstorrs
2020-4-29 20:37:21

When I scribble list-utils.scrbl it does work and generate the examples correctly.


sorawee
2020-4-29 20:41:32

Right. Instead of "../list-utils.rkt", use absolute module path instead


sorawee
2020-4-29 20:41:48

E.g., handy/list-util


sorawee
2020-4-29 20:42:02

Same for "../main.rkt", change it to just handy.


samth
2020-4-29 20:42:20

that’s a problem with the current directory


samth
2020-4-29 20:42:49

what @sorawee suggests is probably the best option, but you can also use define-runtime-path to solve this


dstorrs
2020-4-29 20:59:00

Okay, I did that and it ran without errors, but it did not generate HTML files.


dstorrs
2020-4-29 20:59:37

Is there a way to get to the docs from CLI or do I need to fire up DrRacket?


samth
2020-4-29 20:59:44

what does raco docs &lt;some handy function&gt; do?


dstorrs
2020-4-29 21:00:41

Nothing


dstorrs
2020-4-29 21:00:50

No entry found.


dstorrs
2020-4-29 21:01:09

And it is searching the local docs, not the online, which is good.


dstorrs
2020-4-29 21:02:09

There is a lot of magic in this process.


samth
2020-4-29 21:02:46

what did you do that worked? run raco setup?


dstorrs
2020-4-29 21:03:37

cd ~/projects/handy/scribblings/ &amp;&amp; rm -f ~/projects/handy/scribblings/*.html &amp;&amp; raco setup handy


dstorrs
2020-4-29 21:04:05

I’ll try doing a raco setup


sorawee
2020-4-29 21:05:17

raco setup will likely generate html files at ~/projects/handy/doc


dstorrs
2020-4-29 21:05:48

Ahah!


dstorrs
2020-4-29 21:05:53

You are brilliant, thank you.


dstorrs
2020-4-29 21:06:12

Yes, it did and they are correct.


dstorrs
2020-4-29 21:06:29

Oof. Finished.


dstorrs
2020-4-29 21:07:10

Now to document the other 20+ files. heh


dstorrs
2020-4-29 21:11:39

Wow. raco setup is still running


pavpanchekha
2020-4-29 21:29:14

Where’s the source code for the profiler?


pavpanchekha
2020-4-29 21:29:24

Can’t seem to find it in the Racket tree


pavpanchekha
2020-4-29 21:29:48

nm it’s its own repo


pavpanchekha
2020-4-29 21:36:53

@samth I went ahead and wrote a function to merge profiles, and also export/import for profile data to JSON. Should I PR to the profile package?


samth
2020-4-29 21:37:02

yes!


pavpanchekha
2020-4-29 21:42:20

What should I do here with Herbie? I don’t want to depend on unreleased code, so should I ship a duplicate library until I’m ready to bump the version requirement?


spdegabrielle
2020-4-30 00:10:56

What are HAMTs ? I’ve been following the 7.7 release process. The come up as ‘ dramatically reducing the memory required for immutable hash tables.’


pavpanchekha
2020-4-30 00:15:05

One day of hacking on the Racket profiler has paid off:


pavpanchekha
2020-4-30 00:15:10


samth
2020-4-30 01:00:32

Once your PR is merged, you can just depend on that version of the “profile” pkg (probably by including a version bump for that pkg in your PR).


samth
2020-4-30 01:00:53

If you want a new version of Herbie before that, you could depend on your fork of Herbie.


badkins
2020-4-30 01:29:04

I’ve read that the FFI has changed in Racket CS. Are Racket CS programs able to call C functions? I’m primarily interested in calling Julia programs, and if necessary, I can do this with a variety of means, but Julia can be embedded in a C program, so a C FFI seems like it might be nice.


jcoo092
2020-4-30 02:14:32

@jcoo092 has joined the channel


samth
2020-4-30 02:34:22

@badkins For programs that are using the FFI to call external C libraries, Racket CS changes the FFI only a tiny bit (some details with byte string representation, for example). The C-interop changes are almost all about embedding Racket in C programs, which is much different in Racket CS.


samth
2020-4-30 02:34:45

@pavpanchekha that looks awesome


samth
2020-4-30 02:35:08

HAMTs have been used as the implementation for quite a while, it’s just the Racket CS implementation got faster.