blerner
2017-9-17 14:09:09

Hopefully quick question: in scribble, if I want to write @racketblock[(cons (circle 30 "solid" "red") '())], it’ll typeset all that text just fine. How do I anti-quote the call to circle so that it evaluates to a picture, and I get typeset output of (cons <the actual circle> '())?


mflatt
2017-9-17 14:13:23

@blerner #,


blerner
2017-9-17 14:14:32

perfect, thanks :slightly_smiling_face:


blerner
2017-9-17 14:15:29

(might be nice to mention that in https://docs.racket-lang.org/scribble/reader.html...)


mflatt
2017-9-17 14:16:41

Well, it’s a racketblock escape, not an at-reader escape


blerner
2017-9-17 14:18:58

mmm, fair. and it is indeed mentioned in racketblock, so I sit corrected :slightly_smiling_face:


leif
2017-9-17 17:15:05

Is calling callback-proc in atomic mode (in the following snippet) safe?:

(define ffmpeg-log-list '())
(struct ffmpeg-msg (name
                    level
                    msg))

(define (callback-proc name level len msg)
  (define name* (or name #"???"))
  (set! ffmpeg-log-list (cons (ffmpeg-msg name* level msg) ffmpeg-log-list)))

leif
2017-9-17 17:15:33

It doesn’t need to synchronize on anything. It does do two constructions (the pair and the ffmpeg-msg)


leif
2017-9-17 17:15:45

And it does do a set! on a list.


leif
2017-9-17 17:16:08

(One other place in the code also can set! the list, although it also runs in atomic mode.)


leif
2017-9-17 17:16:35

This code seems to be safe most of the time, but occasionally makes things deadlock.


leif
2017-9-17 17:41:40

Hmm…I seem to get the same behavior even when I do: (define (callback-proc name level len msg) (define name* (or name #"???")


leif
2017-9-17 17:41:52

errr


leif
2017-9-17 17:41:58
(define (callback-proc name level len msg)
  (define name* (or name #"???")
  (void))

leif
2017-9-17 19:37:12

hmm…here’s any idea. @mflatt, what happens when Racket is already in atomic mode, and an FFI call from another os-thread calls a racket callback. Would the async-apply wait until Racket leaves atomic mode?


notjack
2017-9-17 21:22:11

@leif the questions you ask when you’re developing video make me scared to do anything FFI related :p


leif
2017-9-17 21:50:37

@notjack lol


leif
2017-9-17 21:50:43

Its actually not that bad for the most part.


leif
2017-9-17 21:51:12

And honestly, the fact that I can even ask those questions is pretty impressive, and speaks a lot to how good the ffi is. :slightly_smiling_face:


notjack
2017-9-17 21:55:13

@leif I believe you, but I remain cautious :p


leif
2017-9-17 21:55:22

lol, fair.


leif
2017-9-17 21:56:09

It is always kind of amusing when you have a program with multiple threading systems running around. And you have to remember which mutex is associated with which system to avoid deadlocks…


notjack
2017-9-17 21:56:33

oh jeez


leif
2017-9-17 21:57:15

He, he. Hopefully Sam Caldwell will get some of his concurrency DSLs out there, as that can help eliminate a lot of the problems. )


leif
2017-9-17 21:57:16

:slightly_smiling_face:


leif
2017-9-17 21:57:28

But ya. IMO, it really is quite fun. ^.^


notjack
2017-9-17 21:58:15

have no idea who that is but concurrency dsls sound interesting


notjack
2017-9-17 21:58:19

do you have a link?


leif
2017-9-17 21:59:41

Not yet no. He is a PhD student who was doing a lot of stuff with @tonyg (who does seem to actually be on here. :wink: )



notjack
2017-9-17 22:00:25

syndicate I have poked at a little


leif
2017-9-17 22:00:50

leif
2017-9-17 22:00:51

Ah, okay


mflatt
2017-9-17 22:06:27

@leif Yes, atomic mode means that async-apply callbacks must wait


notjack
2017-9-17 22:28:54

what is the user package scope for? going through the docs it seems to be so different users of the same computer can have different packages installed, but conflict checking is across all installed packages. why would it be useful then?


mflatt
2017-9-17 23:06:02

@notjack It doesn’t work if installation-scope packages depend on user-scope packages, but the intent is that all dependencies go the other way. It also doesn’t work if installation-scope packages change out from under a user. The normal case is that a distribution has installation scope and doesn’t change, and everything else is in user-scope.


notjack
2017-9-17 23:09:09

@mflatt would it prevent a command like raco pkg update --auto mypkg from updating installation scope packages because that might cause problems?


mflatt
2017-9-17 23:12:39

In a setting with user-scoped packages, normally that’s the default (so raco pkg actions tend not to affect installation scope) and normally the catalog is configured so that an unchanging set of packages are reported for the installation (i.e., the catalog for a release, which freezes all of the packages that are included in the main distribution).


notjack
2017-9-17 23:14:12

@mflatt I think the main distribution packages are in both the normal catalog and a release catalog; do different installation scopes use different sets of package catalogs to resolve names to sources?


mflatt
2017-9-17 23:19:25

No, they use the same catalogs, but the release catalog is ordered first in the search


notjack
2017-9-17 23:22:00

I don’t think I understand why there are package scopes then, since the “main distribution packages are frozen” behavior arises naturally due to how catalogs are configured


mflatt
2017-9-17 23:39:16

It’s not about which packages are updated, but about which directories can be written to install new packages. For a multi-user setting, the main distribution can be installed in "/usr/local" and shared among users. But users cannot install new packages there; they need to install packages in their own space, while sharing as much as possible with the main installation.


notjack
2017-9-17 23:42:50

@mflatt ohhh, so it’s more about machine permissions and administration, instead of isolating packages from each other or dependencies?


mflatt
2017-9-17 23:43:06

yes


notjack
2017-9-17 23:44:15

how does using a directory as a package scope instead of using the installation or user scopes play into that?


mflatt
2017-9-18 01:08:34

@notjack A directory is meant to be an extra installation-like layer, similar to "/usr/lib" versus "/usr/local/lib".


notjack
2017-9-18 01:12:23

@mflatt ah, that makes sense. thanks for explaining all this!


jcmdln
2017-9-18 01:45:50

@jcmdln has joined the channel


aniket965.as
2017-9-18 02:36:46

@aniket965.as has joined the channel