samth
2018-4-24 15:25:32

@mflatt is it part of the semantics that the results of prefab-struct-key are interned?


mflatt
2018-4-24 15:41:54

No, although I can see why that happens in the current implementations and why some code might accidentally depend on it


mflatt
2018-4-24 15:42:33

I don’t think it’s interned across the span of declarations/instances


samth
2018-4-24 15:44:07

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)


mflatt
2018-4-24 15:45:48

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


mflatt
2018-4-24 15:46:17

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)


cadr
2018-4-24 21:29:24

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


cadr
2018-4-24 21:29:48

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


mflatt
2018-4-24 21:40:00

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)


mflatt
2018-4-24 21:53:23

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


mflatt
2018-4-24 21:54:56

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


mflatt
2018-4-24 21:55:19

Other paths, like 'config-dir are similarly hardwired


cadr
2018-4-24 23:52:48

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


mflatt
2018-4-25 00:09:58

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


cadr
2018-4-25 00:18:48

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


samth
2018-4-25 02:47:18

@cadr I don’t think we want it to be absolute — usually you can move the racket install around and it keeps working


samth
2018-4-25 02:47:50

but maybe an absolute path for the moment would be ok