jerome.martin.dev
2018-4-17 08:06:28

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


afbytes
2018-4-17 10:41:08

@afbytes has joined the channel


pocmatos
2018-4-17 10:41:27

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?


jerome.martin.dev
2018-4-17 12:05:14

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:


jerome.martin.dev
2018-4-17 12:17:00

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



ben
2018-4-17 13:25:51

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


greg
2018-4-17 13:26:31

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


pocmatos
2018-4-17 13:29:04

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


pocmatos
2018-4-17 13:29:30

@greg didnt know about syntax warn. Thanks


pocmatos
2018-4-17 13:51:10

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


greg
2018-4-17 13:52:54

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


greg
2018-4-17 13:53:18

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.


pocmatos
2018-4-17 13:55:20

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.


greg
2018-4-17 13:56:37

Having the linter present a suggested rewrite, is neat.


greg
2018-4-17 13:57:13

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


greg
2018-4-17 14:05:11

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.


lexi.lambda
2018-4-17 14:53:17

@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


pocmatos
2018-4-17 15:26:28

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


notjack
2018-4-17 15:35:46

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


pocmatos
2018-4-17 15:38:46

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


notjack
2018-4-17 15:43:33

@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


pocmatos
2018-4-17 15:44:12

@notjack thanks.


hello.wjx
2018-4-17 16:18:17

@hello.wjx has joined the channel


lexi.lambda
2018-4-17 19:28:44

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


lexi.lambda
2018-4-17 19:35:45

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.


lexi.lambda
2018-4-17 19:37:15

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.


mflatt
2018-4-17 20:09:14

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


leif
2018-4-17 20:10:07

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


leif
2018-4-17 20:10:52

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


mflatt
2018-4-17 20:31:24

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


stamourv
2018-4-17 20:41:35

lexi.lambda
2018-4-17 20:42:06

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


stamourv
2018-4-17 20:42:15

:)


leif
2018-4-17 21:48:11

@mflatt Fair enough.


leif
2018-4-17 21:49:13

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.


leif
2018-4-17 21:50:32

(I was looking into it because I noticed that:

         [gc (tell NSGraphicsContext
                   graphicsContextWithGraphicsPort: #:type _pointer cg
                   flipped: #:type _BOOL #f)])

is deprecated.)


mflatt
2018-4-17 21:53:14

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


leif
2018-4-17 21:58:57

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


mflatt
2018-4-17 22:01:47

@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


mflatt
2018-4-17 22:03:28

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


lexi.lambda
2018-4-17 22:04:02

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


notjack
2018-4-17 22:54:25

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


greg
2018-4-18 03:18:24

leif
2018-4-18 03:27:29

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


lexi.lambda
2018-4-18 03:41:35

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