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

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

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

86

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

No idea.

thanks for taking a look

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

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]

7.5 bc

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?

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

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

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.

ok, I’ve been using CS

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

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

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

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)

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

thank you!

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.

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.

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

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.

Thanks.

@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

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

% 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?

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

you aren’t inside a git checkout

I’m followign https://blog.racket-lang.org/2017/09/tutorial-contributing-to-racket.html, but I’m usign

a pre-compiled version of Racket

you probably just need to cd <PKG>

thank you

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”]

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…

@dstorrs you want to use (define scribblings '((<your-main-scribble-file.scrbl> (multi-page))))
in info.rkt

Ah, okay.

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

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

raco setup handy
should do the trick

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

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

@dstorrs: it’s documented at https://docs.racket-lang.org/scribble/how-to-doc.html#%28part._.Multi-.Page_.Sections%29

@sorawee yes but you usually want to do that

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.

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

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

The output looks styled like I expect…

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.

This is an output from scribble rosette-guide.scrbl

And this is the output from raco setup

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

But identifiers like eq?
are not

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

nod

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...

raco setup: --- building documentation --- [16:19:35]
raco setup: 3 running: <pkgs>/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

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

How do I make it look in the correct directory?

fix what @sorawee said, that is

@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?

Yes.

Would it help to cd
to the correct directory first?

So that the current directory is correct?

Idk, just throwing random ideas

I already am.

[dstorrs@MacBook-Pro-2:~/projects/handy/scribblings:<docs*>]$ raco setup handy

Your problem is in a require

not include-section

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

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

Where should I be looking for the incorrect require?

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

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)

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.

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

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

E.g., handy/list-util

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

that’s a problem with the current directory

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

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

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

what does raco docs <some handy function>
do?

Nothing

No entry found.

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

There is a lot of magic in this process.

what did you do that worked? run raco setup
?

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

I’ll try doing a raco setup

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

Ahah!

You are brilliant, thank you.

Yes, it did and they are correct.

Oof. Finished.

Now to document the other 20+ files. heh

Wow. raco setup is still running

Where’s the source code for the profiler?

Can’t seem to find it in the Racket tree

nm it’s its own repo

@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?

yes!

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?

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.’

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



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).

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

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 has joined the channel

@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.

@pavpanchekha that looks awesome

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