notjack
2021-5-5 08:10:47

@mflatt tangentially, why do so many objects that double as events return themselves as their synchronization result? why didn’t they just return (void)?



jagen315
2021-5-5 11:08:27

is there a general rule or wisdom about when to go from syntax objects to structs? And whether to include syntax info in the structs… i’ve also seen structs with an extra field that just contains the entire original syntax object


sorawee
2021-5-5 11:17:23

where did you see syntax object -> structs?


jagen315
2021-5-5 11:21:37

in general? that seems like something very natural to do


jagen315
2021-5-5 11:22:11

the last technique was something my partner came up with in a course I took



jagen315
2021-5-5 11:23:15

make-struct-t


sorawee
2021-5-5 11:25:41

I’m not sure if I follow. I don’t see any syntax object conversion in that file


sorawee
2021-5-5 11:26:54

But generally, I don’t think we convert syntax object to custom structs.


soegaard2
2021-5-5 11:35:14

(define-syntax make-struct-t (syntax-parser [(_ struct-name super-name) #'(struct struct-name super-name (stx) #:methods gen:equal+hash [(define (equal-proc a b equal?-recur) (equal?/recur (struct-copy super-name a) (struct-copy super-name b) equal?-recur)) (define (hash-proc a hash-recur) (hash-recur (struct-copy super-name a))) (define (hash2-proc a hash2-recur) (hash2-recur (struct-copy super-name a)))])])) This macro simply provides gen:equal+hash methods automatically. And at the same time makes the struct named struct-name non-transparent.

For transparent structs there are default equal/hash functions, so maybe the idea is to have a non-transparent struct where equal and hash still works?

See https://docs.racket-lang.org/reference/Equality.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._gen~3aequal%2Bhash%29%29


soegaard2
2021-5-5 11:35:51

Wait a minute … #'(struct struct-name super-name (stx)


soegaard2
2021-5-5 11:36:05

You are right - I missed the extra field.


jagen315
2021-5-5 11:36:15

yeah it makes a struct that is a substruct of another one, with an additional syntax field


jagen315
2021-5-5 11:36:36

and the syntax field contains all the parsed syntax


soegaard2
2021-5-5 11:37:38

It could be used for error messages - it makes it possible to show the user, the piece of code that created the struct.


jagen315
2021-5-5 11:37:51

my problem is always I have these operations that I could easily use at compile or runtime, except for the fact that


soegaard2
2021-5-5 11:37:53

But … I think it is relatively expensive in use.


jagen315
2021-5-5 11:38:04

the compile time function is written using syntax parse


jagen315
2021-5-5 11:38:14

and the runtime one would use match


jagen315
2021-5-5 11:38:31

so who could blame me for preferring structs


soegaard2
2021-5-5 11:39:43

soegaard2
2021-5-5 11:41:08

Here is an example where the field is used: ;; MeasureChecker ;; blames the measure when the measure is too long (define (check-measure-length measure time-signature key-signature) (define measure-length (music:measure-length measure)) (define num-beats (music:time-signature-beats time-signature)) (define stx (music:measure-t-stx measure)) (when (> measure-length num-beats) (blame stx "measure too long")) (when (< measure-length num-beats) (blame stx "measure too short")))


soegaard2
2021-5-5 11:42:10

I am not sure whether this is the only use, but if so it would be better to store the source location information only.


greg
2021-5-5 12:04:52

It helps for simple uses of sync. Like if you don’t want to use, or haven’t yet learned about, handle-evt.


jagen315
2021-5-5 12:04:59

@sorawee was saying we shouldn’t have made these structs at all.. but then I have to parse syntax every time I want to use check-measure-length, and I also couldn’t reuse it at phase 0.


jagen315
2021-5-5 12:06:15

I can see why people used to represent everything as lists


greg
2021-5-5 12:06:18

(I don’t know if that’s the main justification.)


greg
2021-5-5 12:16:01

FWIW you can use syntax-parse at run time on some syntax, if you want. You can also use match at compile time. So I think the decision depends on what your program does with the syntax.


greg
2021-5-5 12:17:51

One thing to keep in mind is that syntax objects are kind of “bags of properties”, you could query for all sorts of info. There’s lexical info, source location, arbitrary syntax-properties. Is that a bug or a feature, for your program? i.e. Do you want to extract some specific set of info and discard the rest, or, do you want the “whole bag”? Depends on the program.


greg
2021-5-5 12:18:42

Maybe for a music language program, I’d favor being explicit about the few (?) specific things from the syntax object the program really cares about. Like in this case, maybe it’s just srcloc for error messages.


greg
2021-5-5 12:19:39

But for a tool analyzing the syntax like Dr Racket check-syntax, I’d probably want to preserve the whole syntax object, or at least preserve it longer and for more pieces of the whole program.


greg
2021-5-5 12:21:41

Other people probably have better advice. My personal TL;DR is it depends on the program you want to write.


jagen315
2021-5-5 12:23:31

alright, thank you for the advice. At least it’s not something where there is one true solution that i just didn’t know about


jagen315
2021-5-5 12:23:39

I am wondering if there wouldn’t be some benefit to something which acts like syntax when you syntax-parse and struct when you match


capfredf
2021-5-5 12:31:46

@mflatt I get this error when building racket codesign --remove-signature "/Users/capfredf/code/racket/racket/bin/racket" /Users/capfredf/code/racket/racket/bin/racket: unimplemented code signing feature


capfredf
2021-5-5 12:33:38

I am on macOS 10.14.6


mflatt
2021-5-5 12:50:08

That’s looks like an old codesign. But the configure script tries to check whether codesign --remove-signature works, so I’m not sure why that went wrong.


capfredf
2021-5-5 12:58:33

This is the first time I ran into this problem. I let XCode install the additional tools again, rechecked out the Racket repo. Now I am running make again. Everything seems fine.


ryanc
2021-5-5 14:34:54

For sufficiently complicated macros, it is helpful to think of the macro as a tiny compiler, and to follow the traditional compiler phases (front end, middle end, back end). And in that case, it certainly makes sense for the macro front end to parse the syntax into an AST. One example of that is the sql library. See sql/private/ast.rkt for the AST definition and sql/private/parse.rkt for the syntax-parsing code. Another example is the implementation of syntax-parse itself: it parses patterns into ASTs and then does multiple transformation passes on the way to code generation.


jestarray
2021-5-5 15:19:46

gratz on 8.1 release :tada: ! the debugger is super smooth being able to spam click Step now


mflatt
2021-5-5 15:41:00

Yes, that was the original thinking.


soegaard2
2021-5-5 15:58:30

Best name for this? (define (merge ps ms) (cond [(empty? ms) ps] [else (match-define (cons p ps-) ps) (match-define (cons m ms-) ms) (list* p m (merge ps- ms-))])) Names: merge braid interleave In the context used, the list ms is shorter than ps.


ben.knoble
2021-5-5 16:32:05

Is that similar to a one-level flattened zip? My thoughts: • zip pairs elements • flatten one level removes the pairs and you just get the list of p m > (define (merge ps ms) (apply append (map list (take ps (length ms)) ms))) > (merge '(1 2 3 4) '(5 6 7)) '(1 5 2 6 3 7) > (merge '((1) (2) (3) (4)) '(5 6 7)) '((1) 5 (2) 6 (3) 7) (We can’t use flatten b/c of that last test-case…)

As far as naming, I prefer interleave /shrug


ben.knoble
2021-5-5 16:32:47

I was a bit lazy with the length calculations, so that version really assumes \|ms\| <= \|ps\|


ben.knoble
2021-5-5 16:33:14

Probably better to take from both (min (length ps) (length ms))


ben.knoble
2021-5-5 16:34:03

Drat, I didn’t spot that yours kept the left-over elements… another append would take care of that, I suspect.


soegaard2
2021-5-5 16:35:00

In my application ps are points and ms are the mid-points. I.e. the first m is the midpoint of the first two points in ps.


soegaard2
2021-5-5 16:35:30

So ms will be one shorter than ps.


soegaard2
2021-5-5 16:36:00

Hadn’t thought of using zip.


ben.knoble
2021-5-5 16:40:09

yeesh: (define (insert-midpoints ps ms) (append (apply append (map list (take ps (length ms)) ms)) (list (last ps)))) I don’t know the * functions well-enough to know if there is a better way to write that. Does assume \|ms\| = \|ps\|+1, but at this point I would call it insert-midpoints lol


soegaard2
2021-5-5 16:45:12

Just realized, that one can do this: (define (merge as bs) (if (empty? as) bs (cons (first as) (merge bs (rest as)))))


ben.knoble
2021-5-5 16:46:22

Yeah that looks like an interleave to me


jestarray
2021-5-5 18:58:12

can you release v8.1 on github also? i think last time whoever was incharge of the archlinux package didnt update until they saw 8.0 on github strangely enough..


samth
2021-5-5 18:59:34

I don’t think we plan to do that.


samth
2021-5-5 19:00:01

I created the 8.0 release on GitHub to test out that mechanism, but we’re not using it right now.


jbclements
2021-5-5 19:03:04

Holy Mackerel! Just updated the release info on Wikipedia, and MAN someone got enthusiastic about semantic web stuff… it looks like things like releases are now directed into wikidata, which sounds like a great idea, but adding the entry for the current release and making it the current release was… well, it involved many steps. Can anyone here shed any light on the motion of wikipedia toward wikidata? It’s clearly well-intentioned, but the current setup is somewhat frightening.


samth
2021-5-5 19:04:57

But @jbclements might have thoughts here.


sorawee
2021-5-5 19:05:59

What do you mean by “too many steps”? What do you find confusing?


jbclements
2021-5-5 19:06:57

Not sure I have any thoughts. I guess the question is how much value is added by announcing the release as a github release, and how much time it takes.


samth
2021-5-5 19:07:35

I think there are a few different things you could do. One is just create a release called 8.1 with no content.


samth
2021-5-5 19:07:49

Another is paste in the release announcement.


jestarray
2021-5-5 19:07:57

seems like its added already: https://github.com/racket/racket/releases so nevermind lol


samth
2021-5-5 19:08:03

And the most involved would be to upload some or all the binaries there.


jbclements
2021-5-5 19:08:07

Okay, to be fair, most of the steps were wondering what the heck wikidata is… it may be that now that it’s set up, it will be fewer steps to take care of. Off the top of my head:


jbclements
2021-5-5 19:08:22
  1. Copy the wikidata Q### id, construct a URL.

jbclements
2021-5-5 19:08:40
  1. Scroll down to the bottom of the releases section, click add to add a new one.

samth
2021-5-5 19:08:40

@jestarray what you see there is just the v8.1 tag, any tag will appear on that page.


sorawee
2021-5-5 19:08:53

sorawee
2021-5-5 19:09:09

You can just click the pencil button. It will bring you to the release section


jbclements
2021-5-5 19:09:13
  1. Add the various fields for the release.

jbclements
2021-5-5 19:09:41
  1. Add the reference to the github tag, and honestly maybe also to the blog post, possibly more authoritative, add relevant fields for each of them.

jbclements
2021-5-5 19:10:12
  1. Click little up-down-arrow-thingy on new release, change to “preferred”.

jbclements
2021-5-5 19:10:17
  1. Click publish

jbclements
2021-5-5 19:10:39
  1. Edit previous release, click little up-down-arrow-thingy to indicate no longer preferred.

jbclements
2021-5-5 19:10:45
  1. Click publish for that one too.

jbclements
2021-5-5 19:11:04

I’m guessing it’s possible to automate… some of that? Not sure, might be more trouble than it’s worth.


sorawee
2021-5-5 19:11:50

You can write a bot to do that


jbclements
2021-5-5 19:12:36

Or maybe you could write a bot to do that :slightly_smiling_face:


sorawee
2021-5-5 19:13:00

lol


jbclements
2021-5-5 19:13:02

Thanks for the tip on the pencil, did not see that at all; I’m used to editing wikipedia pages by clicking the “edit” at the top of the page.


jbclements
2021-5-5 19:14:32

BTW, further reflection now suggests to me that the “someone” that I refer to in my original post may not have been “shadowy people in charge at wikipedia” but rather one of us, and I now feel somewhat embarrassed at having characterized it in this way.


sorawee
2021-5-5 19:14:46

I used to operate a Wikidata bot back in 2013. Things probably have changed a lot since then, but it was pretty straightforward, using the Pywikibot framework.


sorawee
2021-5-5 19:18:12

Looking at the Wikidata entry, it looks like the page was created by a bot.


sorawee
2021-5-5 19:22:59

sorawee
2021-5-5 19:23:57

Looking at the contribution history, I think s/he’s just a regular Wikipedian


jbclements
2021-5-5 20:06:06

waitwaitwaitwait… I just figured out that you’re working with Emina Torlak! I’m doing a very hand-wavy grad seminar on program synthesis right now. Want to come give a guest lecture?


sschwarzer
2021-5-5 21:31:59

Great to see the release of Racket 8.1 ! :tada:

The blog post https://blog.racket-lang.org/2021/05/racket-v8-1.html mentions “Racket CS supports cross-compilation using raco exe ”, but I couldn’t find anything on that in https://docs.racket-lang.org/raco/exe.html . Is the documentation on the web site already up to date for Racket 8.1?


mflatt
2021-5-5 21:52:47

No, the documentation will update once a pkg-build complete, and a new pkg-build takes a while, because all packages have to be built. Probably tomorrow.


jestarray
2021-5-6 04:40:19

what is next up for 8.2? since the chez scheme stuff looks mostly done aside from all the bug reports lol