
By reading this paper, I now understand Racket. Thanks \o/

@afbytes has joined the channel

I am trying to develop a linter of sorts for Racket. I am doing it very simply by reading the file as test. This allows to check easy style issues. However once you get to the point where you want to check variable names, or types or expressions in typed racket this approach falls apart. Surely I can read the module as syntax and handle the ast directly as a syntax object. Is this how you would start for a project of this sort? Is there anything out there from which to take some inspiration?

Hey everyone, if you want to try your hands at making video games in Racket, I just discovered there’s a Lisp Game Jam starting in two days and going until the end of the month. https://itch.io/jam/lisp-game-jam-2018 It’s the perfect opportunity to try out some techniques (especially the really good mode-lambda
package by @jeapostrophe or the HtdP universe
system). I’m curious to see what people are going to come up with :slightly_smiling_face:

If you wanna see what people made the previous years, there are videos on the twitter feed : https://twitter.com/hashtag/lispgamejam

read-lang-file
turns a file into a syntax object http://docs.racket-lang.org/read-lang-file/index.html#%28def._%28%28lib._lang-file%2Fread-lang-file..rkt%29._read-lang-file%29%29

also (probably more useful) DrRacket’s check-syntax tool has an API: http://docs.racket-lang.org/drracket-tools/Accessing_Check_Syntax_Programmatically.html

@pocmatos Have you seen syntax-warn
by @notjack? http://jackfirth.github.io/syntax-warn/

@ben will take a look. Thanks. Was unaware of the api for check syntax.

@greg didnt know about syntax warn. Thanks

@greg it seems @notjack syntax warn has all the heavy lifting I need at first sight. I am surprised it exists at all since when I asked on Syntax style linters for Racket people were enthusiastic but nobody referred me to this. Many thanks.

I saw @notjack talk about it at RacketCon some years ago.

I haven’t used it only because I haven’t been writing Racket as part of a team, or accepting huge quantities of PRs, or similar.

I am working for a largish codebase, by myself at the moment, but still want something like this to ensure that over time I follow my own rules.

Having the linter present a suggested rewrite, is neat.

Speaking of which, moving from linting to straight refactoring, for Emacs users there is also @ryanc’s https://github.com/rmculpepper/sexp-rewrite

As for “surprised no one referred you to it”: I’ve been writing Racket since c. 2011. The new pkg manager started in, idk, c. 2014? Anyway, the last 2–3 years there are “suddenly” many new pkgs. Which is great! OTOH it’s probably more than any one person can keep track of, unless they’re deliberately reviewing and curating and writing about Racket packages. AFAIK we don’t have that person.

@mflatt Can I ask you to take a look at another small docs PR when you have a free moment? https://github.com/racket/racket/pull/2043

@notjack what’s the configuration to syntax-warn
supposed to look like? i.e. where can I pass the config of warnings to raco warn
? It seems like the flags to pass configs want it in a submodule but I would prefer to have it away from source code and instead as a project separate file. Or is the idea to have something like: #lang racket/base
(module+ warning-config ...)
and then pass this filename to --config-submod
?

@pocmatos the submodule idea is what I’d like, and it should work like test
submodules do where the tool picks them up automatically without you passing flags. But there is no way to configure anything yet, because I haven’t worked on the project in a while and last time I did it was still at the incomplete prototype stage. The GitHub issue tracker has a lot written down about what still needs to be done though.

@notjack thanks. Will go through the issues later on.

@pocmatos if you do intend to use it seriously, let me know what your main use case is and I’ll see if I can organize the issues and figure out what’s important for your case

@notjack thanks.

@hello.wjx has joined the channel

@mflatt Actually, maybe I retract that PR… on closer inspection, I’m not sure I think I understand what the argument to syntax-local-make-definition-context
does anymore.

I’ve been looking at both the C and Racket expanders to try and figure out what that argument does, but I don’t really get it. I think part of my confusion stems from the fact that there are scopes and there are binding environments, and these are not the same thing, but I don’t completely understand where the line between them is drawn… especially since my understanding is that bindings are internally stored on scopes themselves in some sense.

But specifying a parent definition context doesn’t seem to cause any additional scopes to be added, and it doesn’t even really seem to cause any additional things to be added to the expansion environment. Looking at the Racket source, it changes which “frame” the local bindings are added to, but I don’t know what a “frame” is.

@notjack @zenspider I just pushed an addition to the Guide (section 16.3) on instantiations and visits. That can be a starting point for adding whatever still isn’t explained enough.

@mflatt I just saw your commit, thanks a bunch. :smile:

Now I just need to find a good workflow for screen readers and IDEs…

I haven’t actually pushed the libs, yet, but I will


I’ve seen that before, but it’s still extremely good :)

:)

@mflatt Fair enough.

BTW, I noticed that image->bitmap (in the cocoa mred library) doesn’t seem to be used anywhere. I mean, clipboard uses it in its get-bitmap-data
method, but that doesn’t seem to be called from anywhere.

(I was looking into it because I noticed that:
[gc (tell NSGraphicsContext
graphicsContextWithGraphicsPort: #:type _pointer cg
flipped: #:type _BOOL #f)])
is deprecated.)

Isn’t get-bitmap-data
used by the public get-clipboard-bitmap
in "../common/clipboard.rkt"?

Oh…woops…I’m…errr…blind, thanks.

@lexi.lambda “frame” is within the compile-time environment. Maybe 26:40 at https://www.youtube.com/watch?v=Or_yKiI3Ha4 will help explain. It’s the script “E” in the model at https://www.cs.utah.edu/plt/scope-sets/model.html

Your doc edits look plausible, but I’ll have to check the implementation, too, to make sure

@mflatt Thanks, I was actually 27 minutes into watching that talk for the third time. :) I’m about to leave, though, so I’ll pick it up again when I get home, or tomorrow if I don’t finish it tonight.

@mflatt My God, that guide section is extremely helpful. Thank you so much. So many things make way more sense to me now.

Yes that’s awesome — thanks @mflatt ! https://github.com/racket/racket/commit/959a57d31f7da7f50e882c87bb5a2c825b1196c7

@mflatt Another question, the objective-c ffi docs don’t seem to say how to extend an object’s constructor. (the init
method?), is that possible?

@mflatt I’m finally taking the time to read the model in detail. It’ll take me some time to understand all of it, but from what I’ve read so far, I still don’t understand how the concept of a “frame” in the new expander relates to concepts in either the talk or the model. Both portray the environment as a mapping from bindings to either variables or transformer procedures, which makes sense to me, and fits with my existing intuition, but in the new expander, a “frame” appears to be a property of a binding, which seems orthogonal. In expander/syntax/full-binding
, a comment notes that frame-id
is “used to trigger use-site scopes”, which makes me wonder if it’s related to \hat{Σ} in the model rather than ξ (assuming that’s what you meant by “script E”; I don’t see a script E anywhere, but maybe I missed what you’re referring to). IIUC, the talk doesn’t cover the details of tracking/pruning use-site scopes because it doesn’t deal with definitions, so my understanding of that process is still pretty fuzzy.
Also, I feel a little bad for dogpiling on you in this chain of mentions here, so to be clear, I don’t mind being told that now is not a good time for me to ask all these questions. :) I’m sure you’re plenty busy already without them, so I’ll focus on working through the model tomorrow, and maybe that will be enough to clear up my confusion.