massung
2021-6-7 13:50:52

Trying something simple out and a bit confused on the output I’m seeing: > (for ([i (range 10)]) (thread (λ () (println i)))) 9 8 7 6 5 4 3 2 1 0 To be clear, I don’t care about the order of the output. What I care about is that each line of the output is distinct. The value if i is being directly manipulated by the loop whether or not the thread has begun executing or not. So, unless the lexical context of the lambda is being copied by thread, I full expected the output to be something like (for example): 6 6 5 4 7 7 7 3 3 0


massung
2021-6-7 13:51:57

Either that, or Racket threads have no correlation to OS threads and do not actually run in parallel at all.



soegaard2
2021-6-7 13:53:18

Racket supports multiple _threads_ of evaluation. Threads run concurrently, in the sense that one thread can preempt another without its cooperation, but threads currently all run on the same processor (i.e., the same underlying operating system process and thread).


samth
2021-6-7 13:53:21

They don’t run in parallel, but that isn’t what’s going on


samth
2021-6-7 13:54:16

for doesn’t mutate the variable i, instead there’s effectively a function that takes i as an argument; it’s called with the values from 0 to 9, and that function creates a thread that prints i


massung
2021-6-7 13:54:36

Okay, so a simple let-over-lambda expansion going on


samth
2021-6-7 13:55:07

in general you should not expect there to be implicit mutation in Racket


massung
2021-6-7 13:56:43

Started b/c I was surprised that thread didn’t allow passing an argument list (for exactly the reason I incorrectly assumed above). Put together a bunch of tests and couldn’t get the “bad” behavior to happen. :slightly_smiling_face:


mflatt
2021-6-7 14:07:35

Thanks!

I’ve gradually updated things so that the links for “git+https” sources are corrected, but I haven’t done anything lately that would fix package-submission problems. FWIW, I was able to create a new package just now. I didn’t find anything in the logs to explain what went wrong in your attempts, but I’m not certain that I looked in the right places.


gmauer
2021-6-7 14:07:43

@gmauer has joined the channel


gmauer
2021-6-7 14:10:56

Hi everyone. I’ve been a racket-newbie for a few years now. It’s probably my favorite language in terms of just thinking how I think, but its hard to get enough expertise to really roll it into may day to day.

One thing I did create is my own racket mode for emacs if anyone wants to check it out https://github.com/togakangaroo/ob-racket While a couple other modes exist, I found no easy way of playing around with building custom languages in org documents (which is my default for exploring stuff) so this mode has that capability (see the “custom languages” part of the readme)


sorawee
2021-6-7 14:17:09

Can anyone with M1 and recent Racket build / snapshot try the macro stepper on

#lang racket (struct a ()) and click step until the end? Is there a problem?

It crashes for me, and I want to make sure the problem is not due to my local configuration.


mflatt
2021-6-7 14:29:42

It steps to the end for me with no error.


sorawee
2021-6-7 14:31:44

I thought the problem is that I have an outdated dylib, but I just copied https://github.com/racket/libs/blob/master/draw-aarch64-macosx-3/racket/draw/libcairo.2.dylib to ./racket/share/pkgs/draw-aarch64-macosx-3/racket/draw/libcairo.2.dylib, and the problem persists.


sorawee
2021-6-7 14:32:26

The error is:

cairo_quartz_get_cg_context_with_clip: implementation not found; arguments: #<cpointer> context...: /Users/sorawee/projects/racket/racket/share/pkgs/draw-lib/racket/draw/private/emoji.rkt:159:7: draw-loop /Users/sorawee/projects/racket/racket/share/pkgs/draw-lib/racket/draw/private/dc.rkt:1457:4: do-text method in dc% ... internal error: attempt to deschedule the current thread in atomic mode context...: /Users/sorawee/projects/racket/extra-pkgs/gui/gui-lib/mred/private/wx/common/queue.rkt:634:3 ... internal error: terminated in atomic mode!


mflatt
2021-6-7 14:34:27

What checksum of draw-aarch64-macosx-3 do you have installed?


sorawee
2021-6-7 14:35:54

f252e


mflatt
2021-6-7 14:37:31

And openssl sha1 libcairo.2.dylib (in racket/lib) reports 514321ed81…?


sorawee
2021-6-7 14:38:38

Well, there is no libcairo.2.dylib in racket/lib


sorawee
2021-6-7 14:39:10

These are all what I have in ./racket/lib

<http://GRacket.app\|GRacket.app> <http://Starter.app\|Starter.app> libcrypto.1.1.dylib libintl.9.dylib librktio.dylib mans.rktd scheme.boot <http://GRacketBC.app\|GRacketBC.app> buildinfo libedit.0.dylib libmpfr.4.dylib libs.rktd mzdyn3m.o starter MMTabBarView.framework launchers.rktd libexpat.1.dylib libmpfr.4.dylib.bak libssl.1.1.dylib petite.boot starter-sh Racket.framework libatk-1.0.0.dylib libffi.6.dylib libracketcs.a libuuid.1.dylib racket.boot system.rktd


sorawee
2021-6-7 14:39:59

But if you mean racket/share/pkgs/draw-aarch64-macosx-3/racket/draw, then yes, the file has that checksum.


mflatt
2021-6-7 14:41:00

Running raco setup should copy the “.dylib” from there to “lib”.


sorawee
2021-6-7 14:41:51

I just ran git pull; make. That should implicitly run raco setup, no?


sorawee
2021-6-7 14:41:59

But I can try it again.


sorawee
2021-6-7 14:46:35

raco setup is done. Nothing is copied. And it still crashes.


sorawee
2021-6-7 14:48:40

Let me start from a fresh clone and see if that helps


mflatt
2021-6-7 14:48:48

The problem is whatever keeps the “.dylib” from being copied, but I don’t know what that could be.


mflatt
2021-6-7 14:50:19

Anything customized in etc/config.rktd?


sorawee
2021-6-7 14:51:49

Ohh, that might be it. I added:

(lib-search-dirs . ("/opt/homebrew/lib/" #f))


sorawee
2021-6-7 14:52:35

Should #f come before "/opt/homebrew/lib/"?


sorawee
2021-6-7 15:13:44

Yeah, with a fresh clone, it now works properly.


sorawee
2021-6-7 15:15:56

Yep, confirming that by removing "/opt/homebrew/lib/" from lib-search-dirs, the foreign libraries are copied properly


sorawee
2021-6-7 15:30:49

Did some experiments:

  • The order of "/opt/homebrew/lib/" and #f doesn’t seem to matter. (lib-search-dirs . (#f "/opt/homebrew/lib/")) wouldn’t copy the foreign libs too.
  • So it looks like if lib-search-dirs is non (#f), the foreign libs won’t be copied. Is this considered a bug though?

mflatt
2021-6-7 16:10:33

Ah, ok. Yes, the library is not installed again if it already exists in the search path. That’s new behavior intended to better support layering, but it conflicts with setting a search path to find libraries that are not installed by raco setup.


mflatt
2021-6-7 16:12:48

Probably there will need to be a new config.rktd option for layering.


mflatt
2021-6-7 16:24:47

Or maybe layering support should copy if the existing library is not the same as the one that would be installed. That’s a simpler and maybe better choice in the case of libraries.


ben.knoble
2021-6-7 19:46:42

I have a feeling this involves custodians, which I know nothing about, but I would like to delete a temporary directory when my program exits, even if in error. Any pointers?


ben.knoble
2021-6-7 19:47:59

(This wouldn’t be necessary if I could find a mkdtemp or similar; as a hack, I’m making directories in (find-system-path 'temp-dir), which is the same place between runs.)


samth
2021-6-7 19:56:47

@ben.knoble see plumbers, but also see make-temporary-file with 'directory as the second argument


ben.knoble
2021-6-7 19:57:58

I looked at make-temporary-file, but IIUC that makes files and not directories; I need to make a directory (in which I am unzipping an archive). I’ll look at plumbers, though.


samth
2021-6-7 20:03:14

@ben.knoble to be a little less oblique, (make-temporary-file "mydir-~a" 'directory) makes a directory


ben.knoble
2021-6-7 20:06:04

Ah, I misunderstood the phrasing “combined with” in the docs. This looks like what I need. Thanks @samth!


petertbrady
2021-6-7 20:34:04

@petertbrady has joined the channel


ben.knoble
2021-6-7 21:18:23

The latest version of the archive is up-and-running at https://benknoble.github.io/racket-slack-archive/ (extends through roughly 2021–05–16). The site is now built using a mix of Racket (data processing) and Jekyll/Ruby (site-generation). I have some todos to make a nicer experience, and help is welcome. (Also if anyone wants to start working porting the Jekyll + Ruby stuff to Racket, feel free.)


samth
2021-6-7 21:38:15

spdegabrielle
2021-6-7 22:09:08

This is awesome. Thank you. You should put this in the next Racket News https://github.com/pmatos/racket-news/issues/new\|https://github.com/pmatos/racket-news/issues/new @pocmatos


ben.knoble
2021-6-7 22:15:47

Thanks Stephen!


jagen315
2021-6-7 22:30:58

does anyone have a good list of uses of racket in industry? even chez scheme. or just scheme in general…




jagen315
2021-6-8 04:47:05

thank you! any other input welcome. Trying to build a case for using racket at work