@mflatt is it part of the semantics that the results of prefab-struct-key
are interned?
No, although I can see why that happens in the current implementations and why some code might accidentally depend on it
I don’t think it’s interned across the span of declarations/instances
Ok. I couldn’t find a case where I got non-eq?
values, but we had a bug in Pycket that could either be fixed by interning, or by comparing things structurally, and wanted to be sure that interning wasn’t required (cc @cadr)
FWIW, here’s an example where the result is non-eq?
even though the keys describe the same prefab type: (define t-key1
(let ()
(struct s () #:prefab)
(struct t s () #:prefab)
(prefab-struct-key (t))))
(collect-garbage)
(define t-key2
(let ()
(struct s () #:prefab)
(struct t s () #:prefab)
(prefab-struct-key (t))))
As long as a structure type for a prefab is retained, though, the key extracted from it will be the same (because it’s attached to the structure type)
@mflatt I’m trying to implement a find-system-path
on Pycket that doesn’t get any help from the Racket binary. For example for the exec-file
, Racket seems to ask the OS for the location of the binary, but I can’t figure out how. Can you tell me how/where does it do it? Thanks!
@mflatt We also looked at Chez but it seems to get those paths as arguments from racket_boot
that’s called from main.c
, and for example for the collects-dir
, it seems to use the internal function extract_coldir()
and it just has a path inside that I’ve no idea how :slightly_smiling_face:
First reaction (not complete sure I’m answering the right questions): The relevant input for find-system-path
should be the same as (system-path 'exec-file)
, which can return argv[0]
as passed to main. Although “main.c” for RacketCS gets the executable path in other ways, too, that’s for getting the built-in code, and not for (system-path 'exec-file)
@cadr I’m mixing up find-system-path
and find-executable-path
. But I think maybe I answered the right question as a subpart above: just use argv[0]
.
… for 'exec-file
. For 'collects-dir
, the answer is hardwired. It’s hardwired in the binary in a way that raco exe
can find and rewrite, but you don’t need to worry about that for now.
Other paths, like 'config-dir
are similarly hardwired
@mflatt Ah ok thanks! I think I can set the exec-file
(also the find-executable-path
) to argv[0], the pycket’s binary, but actually my main problem is to find the Racket’s main collection in the system (the collects-dir
), Pycket currently has no way of knowing where the Racket is located in the system and I’m trying to figure out the best way of locating it (without using the Racket binary).
@cadr I’m not sure of the right answer, but you should make 'exec-file
and 'collects-dir
together point to the “collects” dir. That might be by setting 'exec-file
to the Racket executable, instead of Pycket’s argv[0]
. Or it might be setting 'collects-dir
relative to Pycket. Or make 'collects-dir
an absolute path.
@mflatt I see. I think setting the 'exec-file
to pycket would be more accurate (@samth?), so in that case would making the 'collects-dir
absolute be ok?
@cadr I don’t think we want it to be absolute — usually you can move the racket install around and it keeps working
but maybe an absolute path for the moment would be ok