
All, I am having a go at porting some of my code to Typed Racket to understand impact in performance. Interestingly, when I call place/context
, the type checker tells me instead the problem is with place/proc
: driver.rkt:135:4: Type Checker: missing type for identifier;
consider using `require/typed' to import it
identifier: place/proc
from module: racket/place
in: (for/list ((i (in-range cores))) (place/context ch (define s (solve/single authdata diff i)) (place-channel-put ch s)))

So, now shall I require/typed
place/context
or place/proc
?

Also, strange that typed racket knows of type Place
but not of place/context
…

Interesting, actually place/proc
is not provided so I can’t type it but I don’t think I can type place/context either since it’s a macro.

I’ve noticed the documentation about several concepts doesn’t go into details about how those concepts work/are implemented at lower levels. For places
, I had to read place.c
and mzrt.h
to figure out that places use posix threads/win32 threads based on the operating system (my first guess would’ve been processes communicating via IPC). I was similarly confused about threads initially, wondering whether they were green threads or system threads with a GIL, though some part of the documentation did answer that question for me (I don’t think it was the threads reference, however).
Is this a conscious choice to hide those details from the reader/user so that the runtime is free to change them as it sees fit?


@popa.bogdanp I don’t think it’s a problem to hide the implementation details. after all the user shouldn’t care about it and the documentation is clear that places use OS threads.

My question was due to the fact that the typed racket error mentions a function that is not provided and the user should not need to care about.

At the same time, it feels like it might be tricky to type this one. Surely @samth can enlighten us.

Is it a known issue that syntax/module-reader
is brittle with respect to the directory that the file is in?
For example, let’s say we have:
;; /path/to/raquet.rkt
#lang s-exp syntax/module-reader
"raquet-mlang.rkt"
;; /path/to/raquet-mlang.rkt
#lang racket
(provide (except-out (all-from-out racket) lambda)
(rename-out [lambda function]))
;; /path/to/a.rkt
#lang reader "raquet.rkt"
(define identity (function (x) x))
(print (identity 5))
This is an example from https://docs.racket-lang.org/guide/syntax_module-reader.html whick works without any problem.
Now, create a new file:
;; /path/to/test/b.rkt
#lang reader "../raquet.rkt"
(define identity (function (x) x))
(print (identity 5))
Running it, we get this error:
/path/to/test $ racket b.rkt
open-input-file: cannot open module file
module path: /path/to/test/raquet-mlang.rkt
path: /path/to/test/raquet-mlang.rkt
system error: no such file or directory; rktio_err=3

I didn’t mean to imply that it was! But the documentation wasn’t clear to me that places use OS threads. :slightly_smiling_face:

All it really says is that places let you take advantage of multiple CPUs, cores or hw (hyper) threads.

And so when I read that I saw two options: either they were implemented using OS threads or using processes; but the docs didn’t tell me which and the performance characteristics for either are different.

@pocmatos indeed the user shouldn’t need to care about it, but this is a limitation of how TR works that you do, in fact, have to care about it

adding types to the place
form will require somewhat more work than just using require/typed

Well, you certainly need to care about if need to extend typed racket to support the place
form.

I am surprised, why support the Place
but not the place
form? Is it expected from users to move place
calls to the untyped world?

note that dynamic-place
works already

as you note, place
is trickier

but we should try to support it

the place
form expands to a submodule, which it’s not immediately obvious how to handle

Ah, understood. I will switch this part to using dynamic place and see what happens.

Right - makes sense. Dynamic place is a function, not syntax.

It’s been over 24h since I’ve published my first package (https://pkgd.racket-lang.org/pkgn/package/component-lib) and it still doesn’t have any builds. I’m wondering if I did something wrong or if I skipped some vital step. Reading the source of pkg-index
it looks like packages with changes should be built every hour, but I can’t figure out why this one isn’t. Any ideas?

@popa.bogdanp every hour, the index of packages is updated (which indeed has happened for your package)

every 24 hours http://pkg-build.racket-lang.org\|pkg-build.racket-lang.org runs, but it might not be done with this morning’s run yet

Ahh, okay. Thank you for clarifying!