wanpeebaw
2020-12-14 10:57:28

Does Racket currently use nanopass framework to compile itself?


soegaard2
2020-12-14 11:09:04

Nanopass is used to build Chez Scheme.


spdegabrielle
2020-12-14 11:22:02

Does that mean Racket-CS uses the nanopass framework to compile because it is built on Chez? (I think it does - but I’ve been wrong before)


soegaard2
2020-12-14 11:41:07

As far as I know the Racket-toChez compiler doesn’t use Nanopass. But the compiler from Chez Scheme to machine code is built with Nanopass.


spdegabrielle
2020-12-14 11:42:34

I didn’t think of that.


spdegabrielle
2020-12-14 11:47:54

Does that mean when we compile Racket CS to machine code we have Racket [-no-nanopass->] ChezScheme [-nanopass->] machine code? i.e. only the last part uses nanopass framework and ‘transpiling’ Racket to Chez uses a single pass through a separate compiler?


soegaard2
2020-12-14 11:49:25

I could be wrong, but yes to the first question. I don’t think “the transpiling” is done in a single pass though.


soegaard2
2020-12-14 11:49:37

But I don’t know.


spdegabrielle
2020-12-14 11:50:55

This is probably in the documentation. I should look. (I will later)


mflatt
2020-12-14 13:01:12

There are multiple passes even in the Racket -> Chez Scheme step, but that’s basically right.


laurent.orseau
2020-12-14 13:33:14

Is there a doc that says what each pass does in both worlds?


mflatt
2020-12-14 13:40:32

No, there’s just the implementations right now.


dvanhorn
2020-12-14 15:48:45

Does anyone understand why this program immediately consumes all of the cpu while avoiding peeking-input-port (i.e. reading from in) does not? #lang racket (define-values (in out) (make-pipe)) (fprintf out ".") (let ((i (peeking-input-port in))) (displayln (read-line i)))


mark.warren
2020-12-14 15:51:22

I don’t know for sure but I would suspect trying to display the result of read line creates an infinite loop.


soegaard2
2020-12-14 15:52:34

Does it help to change the buffer mode?


dvanhorn
2020-12-14 15:55:49

I see the same behavior if I set it to ’block or ’none


mflatt
2020-12-14 16:09:15

From a quick look, it seems to be a problem with peeking-input-port.


mflatt
2020-12-14 16:12:50

Specifically, peeking-input-port uses the pipe as an event when it can’t peek more past the first byte, but the pipe is ready as an event since there’s a byte ready.


dvanhorn
2020-12-14 16:32:43

Thanks, should I file an issue?


mflatt
2020-12-14 16:35:00

No need


daniel.kvasnicka.jr
2020-12-14 19:31:19

Sorry if this has already been asked & answered but why is https://download.racket-lang.org/releases/7.9/catalog/ throwing 404?


daniel.kvasnicka.jr
2020-12-14 19:32:16

I get stuff like &gt; raco pkg migrate 7.7 Packages to install: racket-langserver rackjure retry 00: Resolving "racket-langserver" via <https://download.racket-lang.org/releases/7.9/catalog/> 01: Resolving "rackjure" via <https://download.racket-lang.org/releases/7.9/catalog/> raco pkg migrate: cannot find package on catalogs package: racket-langserver raco pkg migrate: cannot find package on catalogs package: racket-langserver


daniel.kvasnicka.jr
2020-12-14 19:32:20

is that expected?


samth
2020-12-14 19:36:21

@daniel.kvasnicka.jr there are two issues here. One is that the initial release of 7.9 had a problem in the configuration; that has been fixed if you download what’s on the website (it was fixed a couple weeks ago). Second is that the URL you posted doesn’t serve any content; that is not a problem; see for example https://download.racket-lang.org/releases/7.9/catalog/pkgs which returns the correct data.


tochukwueze2025
2020-12-14 20:08:47

@tochukwueze2025 has joined the channel


daniel.kvasnicka.jr
2020-12-14 20:19:08

Ah, so this seems to be a Manjaro Linux package issue then. Thanks @samth for the info!


samth
2020-12-14 20:19:28

They likely need to update.


samdphillips
2020-12-14 20:31:35

Will breaks generated from the OS only be received by the main thread (or a nested thread of the main thread?)


mflatt
2020-12-14 20:55:20

Yes


soegaard2
2020-12-14 21:09:34

I have a package that uses ffi-lib to load some libraries.

What’s the best way to allow the user to change the path of the libraries loaded?

Is there an example / library somewhere I can look at?

At first I thought - just use a parameter - but that’s not going to be enough. https://github.com/soegaard/sci/blob/master/flomat/flomat.rkt#L72


laurent.orseau
2020-12-14 21:14:37

define-ffi is syntax, so a parameter won’t do. A simple option is an environment variable, but of course this requires to re-setup the library if the variable changes, and raco may not see the need to recompile since the files haven’t change. So this can be problematic (best way to solve this: delete all compiled directories of the collection).


mflatt
2020-12-14 21:14:41

Is there a reason not to rely on OS-level environment variables like LD_LIBRARY_PATH?


soegaard2
2020-12-14 21:26:39

I suppose an environment variable could work. The tricky part about BLAS and LAPACK is that there are several versions around. Some use OpenBLAS and others use what Intel provides. So a user might want to see which of the different versions that work best on his machine.

I can’t think of a better way than using an environment variable, so I’ll try that. It would be simpler to the explain the setup without though.

Is LD_LIBRARY_PATH also used on Windows?

I had a Windows user that installed libopenblas.dll in “c:/users/username/projects/blas/bin/libopenblas.dll” but that does not seem like a standard installation folder.


samdphillips
2020-12-14 21:27:30

Awesome, that will simplify what I’m working on a lot.


mflatt
2020-12-14 21:34:22

Windows looks for DLLs in PATH instead of LD_LIBRARY_PATH.


soegaard2
2020-12-14 21:37:26

Okay - that sounds simple enough - the user simply needs to add his installation folder to PATH then.


soegaard2
2020-12-14 21:37:31

Thanks.



samth
2020-12-15 04:54:16

That eq? produces #f I hope


notjack
2020-12-15 04:55:57

it does not


notjack
2020-12-15 04:56:30

(refresh the gist, I added comments)


alexharsanyi
2020-12-15 05:35:09

Why is it a problem that eq? produces #t?

Also on Racket CS , the last two immutable? calls produce #f, I suspect unsafe-string-&gt;immutable-string! makes a copy since: (immutable? (unsafe-string-&gt;immutable-string! s1)) produces #t, but running (immutable? s1) after that produces #f


notjack
2020-12-15 05:36:24

because it means different calls to (string-append) return values that all share observable mutable state with each other


notjack
2020-12-15 05:39:53

unsafe-string-&gt;immutable-string! says it “potentially” destroys the string its given and reuses its space, I think it will just sometimes produce #true for the second-to-last immutable? check and sometimes it won’t, subject to implementation whims. But it’s extremely weird that the last immutable? check could ever return #true.


alexharsanyi
2020-12-15 06:03:01

> because it means different calls to (string-append) return values that all share observable mutable state with each other Using string-append with any other string, including passing the same (as in eq? same) string will produce different non-eq? results. It seems that only the empty strings are eq?


sorawee
2020-12-15 06:09:00

In presence of potentially destructive operations, objects should not be shared. I agree that (eq? s1 s2) should be #f.


notjack
2020-12-15 06:18:54

Yeah it’s not exploitable in this case because you can’t change the length of a string, but it’s still very weird and not good


massung
2020-12-15 06:23:06

On 7.8 [3m] I don’t see the same behavior. Is this 7.9 and/or CS?

I’m also guessing this is likely due to string-append having a default return value that’s a literal in it as opposed to returning a new string each time.

The real question is, after you change the string, will a subsequent call to (string-append) return the same, altered string?


massung
2020-12-15 06:26:25

At the end of the day, it’s really just: (eq? (string-append) (string-append)) ;=&gt; #t I think it’s debatable whether this is bad or not. If they are immutable (7.8 [3m] says yes), then there’s no real harm.

If, however - even with “unsafe” code - it’s possible to modify the literal such that later calls to (append-string) end up returning the modified string, I’d consider that pretty bad.


massung
2020-12-15 06:27:21

Regardless, that’s probably up near the top of my list for “best titled gists” :slightly_smiling_face:


notjack
2020-12-15 06:36:46

Literal strings are immutable, not mutable, so I honestly am pretty confused how this behavior came about


notjack
2020-12-15 06:37:18

and I definitely think (eq? (string-append) (string-append))should be true if and only if (string-append) always returns an immutable string


spark122
2020-12-15 07:39:02

@spark122 has joined the channel


wanpeebaw
2020-12-15 07:51:33

bug?