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


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

where did you see syntax object -> structs?

in general? that seems like something very natural to do

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


make-struct-t

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

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

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

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

You are right - I missed the extra field.

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

and the syntax field contains all the parsed syntax

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

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

But … I think it is relatively expensive in use.

the compile time function is written using syntax parse

and the runtime one would use match

so who could blame me for preferring structs


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

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

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

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

I can see why people used to represent everything as lists

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

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.

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.

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.

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.

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

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

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

@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

I am on macOS 10.14.6

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.

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.

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.

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

Yes, that was the original thinking.

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.

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

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

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

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

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.

So ms will be one shorter than ps.

Hadn’t thought of using zip.

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

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

Yeah that looks like an interleave to me

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

I don’t think we plan to do that.

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

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.

But @jbclements might have thoughts here.

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

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.

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

Another is paste in the release announcement.

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

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

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:

- Copy the wikidata Q### id, construct a URL.

- Scroll down to the bottom of the releases section, click add to add a new one.

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


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

- Add the various fields for the release.

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

- Click little up-down-arrow-thingy on new release, change to “preferred”.

- Click publish

- Edit previous release, click little up-down-arrow-thingy to indicate no longer preferred.

- Click publish for that one too.

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

You can write a bot to do that

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

lol

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.

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.

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.

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

Ah, that version number fetching was done by this change https://en.wikipedia.org/w/index.php?title=Racket_(programming_language)&diff=1007696326&oldid=1007635994

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

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?

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?

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.

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