notjack
2021-2-9 09:50:43

better summary messages now


laurent.orseau
2021-2-9 09:54:00

This is truly amazing. Fantastic job! There’s still room for nitpicking fortunately :grin:


laurent.orseau
2021-2-9 09:54:33

(like the let* turned into define +let for example)


notjack
2021-2-9 09:57:02

ah you mean that one case where something like (define (f ...) (let* ([x ...] [x (... x ...)]) ...)) got turned into (define (f ...) (define x ...) (let ([x (... x ...)]) ...))


laurent.orseau
2021-2-9 10:05:57

yep


notjack
2021-2-9 10:09:55

I think it’s… not worse, per se, but yeah it doesn’t seem worth the churn


sorawee
2021-2-9 10:10:16

Personally I prefer the first one


notjack
2021-2-9 11:25:49

interesting case where this: (let* ([dest-file (if (string? dest-file) (string->path dest-file) dest-file)] [renderer (new render% [dest-dir (and dest-file (path-only dest-file))] [refer-to-existing-files use-existing?] [css-path 'inline] [script-path 'inline])] [ci (send renderer collect (list doc) (list dest-file))] [_ (send renderer transfer-info ci (resolve-info-ci (xrefs-ri xrefs)))] [ri (send renderer resolve (list doc) (list dest-file) ci)] [xs (send renderer render (list doc) (list dest-file) ri)]) was changed to this: (let ([dest-file (if (string? dest-file) (string->path dest-file) dest-file)]) (define renderer (new render% [dest-dir (and dest-file (path-only dest-file))] [refer-to-existing-files use-existing?] [css-path 'inline] [script-path 'inline])) (define ci (send renderer collect (list doc) (list dest-file))) (define _ (send renderer transfer-info ci (resolve-info-ci (xrefs-ri xrefs)))) (define ri (send renderer resolve (list doc) (list dest-file) ci)) (define xs (send renderer render (list doc) (list dest-file) ri)) (the (define _ …) form is what’s interesting to me here)


laurent.orseau
2021-2-9 11:34:33

what do you mean?


notjack
2021-2-9 11:38:53

The _ was in the let binding because there’s no way to interleave plain expressions in let bindings and evaluate them for their side effects. So I think the let-to-define migration should recognize that case and turn that binding into an expression instead of a definition.



notjack
2021-2-9 11:57:13

if you’re familiar enough with the refactoring rules DSL, you could attempt writing a rule for that :p


laurent.orseau
2021-2-9 11:57:28

That seems a little risky, but maybe


laurent.orseau
2021-2-9 11:57:53

I want to, but no time right now


notjack
2021-2-9 11:57:56

anyway: with this new pull request, I seek to banish let from scribble forever! https://github.com/racket/scribble/pull/294


notjack
2021-2-9 11:58:31

(actually several uses of let remain but hyperbole is fun)


notjack
2021-2-9 11:58:56

(define _ …) just looks so bizarre. It’s like seeing a fish out of water.


laurent.orseau
2021-2-9 12:01:26

True



sorawee
2021-2-9 12:25:01

Personally, if it doesn’t unindent the body, I’d leave the whole thing alone. Partial conversion is not worth it, IMO.


laurent.orseau
2021-2-9 12:25:45

I concur


notjack
2021-2-9 12:27:13

Unindenting the right-hand-side expressions seems worthwhile to me, especially in cases where some of the let bindings are to lambda expressions.


laurent.orseau
2021-2-9 12:28:08

yeah, but the single let reads uniformly, whereas now you have both define and let


sorawee
2021-2-9 12:28:30

I agree with @notjack partially. There are cases that are worthwhile


sorawee
2021-2-9 12:28:43

But for some, I really disagree



sorawee
2021-2-9 12:28:56

^ this one should not be converted IMO


notjack
2021-2-9 12:29:10

Oh yup that one shouldn’t


sorawee
2021-2-9 12:29:11

let* is an idiom that says, I will keep evolving this variable


notjack
2021-2-9 12:29:23

can you leave a comment to remind me to fix that one


sorawee
2021-2-9 12:29:32

yep


notjack
2021-2-9 12:31:06

I don’t know if I’ll implement that special case in the tool since it seems like a lot of work for not much benefit, but I certainly don’t plan on making that fix purposefully


notjack
2021-2-9 12:32:50

on this point: I kind of like that in the refactored code, whenever I see let forms I can think “oh there’s some sort of shadowing going on here”


sorawee
2021-2-9 12:34:17

I think there’s a simple rule for when partial conversion should be done: when it actually decreases the line width

Compare:

(let ([@expr (if x (litchar/lines (car x)) "")] (define @expr (if x (litchar/lines (car x)) "")) So I do think https://github.com/racket/scribble/pull/294/files?diff=split&w=1#diff-6339e804a7deeaf21b376c41eb4afd3a61b61b341b42f9bc748d5c19935f735aR99 should not be converted.

Removing lambda, on the other hand, is totally worthwhile.


notjack
2021-2-9 12:35:50

what if there’s a clause that doesn’t decrease the line width, then a clause with a lambda, then an unconvertible clause?


sorawee
2021-2-9 12:36:29

Can you prove that the clauses has no side-effect, and thus clauses can be reordered? :stuck_out_tongue:


notjack
2021-2-9 12:36:49

not effectively :p


notjack
2021-2-9 12:37:11

in my own code I don’t use let/let*/letrec at all, so, somewhat biased


sorawee
2021-2-9 12:39:10

I want define* (https://github.com/racket/rhombus-brainstorming/issues/46) in Racket right now :disappointed:


notjack
2021-2-9 12:39:43

god, same


notjack
2021-2-9 12:40:42

redefine seems like a much better name though..


sorawee
2021-2-9 12:41:07

The best name is let :slightly_smiling_face:


notjack
2021-2-9 12:41:38

oh like, (let x expr)? now that’s an idea


sorawee
2021-2-9 12:41:43

yeah


laurent.orseau
2021-2-9 12:41:56

like ML basically?


sorawee
2021-2-9 12:42:00

yes


notjack
2021-2-9 12:42:16

it’s kind of weird to have these two forms just be synonyms with nothing to make it clear why they’d be different (besides history)


laurent.orseau
2021-2-9 12:42:28

(assume-under-the-right-circumstances-that x 3)


notjack
2021-2-9 12:42:42

(without-loss-of-generality-let x 3)


sorawee
2021-2-9 12:42:56

You can go Pyret style here. No need for let with a body. If you need one, you write:

(block (let x 1) body ...) instead of:

(let ([x 1]) body ...)


sorawee
2021-2-9 12:43:14

(although Pyret does have let with body)


notjack
2021-2-9 12:43:28

Yeah I definitely think block is massively underrated


sorawee
2021-2-9 12:43:38

Well, I didn’t mean block in Racket


notjack
2021-2-9 12:44:02

I’m speaking very nonspecifically :p


sorawee
2021-2-9 12:44:04

It’s a hypothetical form that controls scope, but yes, Racket’s block can work too


sorawee
2021-2-9 13:02:09

@notjack what was broken? The latest commit looks like a wrong direction to me.


notjack
2021-2-9 13:31:31

No idea. Saw an error in the CI logs that said something was wrong in that file, so I reverted it.


notjack
2021-2-9 13:32:49

The nice thing about automating these changes is I don’t have to have any particular attachment to them. I can always just rerun the tool and try again later.


sorawee
2021-2-9 13:47:57

Definitely worth investigating the bug, and also check the previous PRs if the same mistake occurs.


notjack
2021-2-9 13:50:48

I’m guessing I just clicked wrong when I was omitting some of the fixes that dropped comments. Lots of error-prone fiddling in the github desktop UI.


sorawee
2021-2-9 13:52:51

wouldn’t git clone locally make your life easier? you can also test locally too.


abmclin
2021-2-9 14:20:33

yeah risky… the ordering of the expressions might matter so would need to make sure the _ position stays the same in the order of the expressions and it might look just as weird to have an expression in middle of a list of definitions.


teh6
2021-2-9 14:44:15

Cool. Thanks for the help :)


greg
2021-2-9 15:54:14

Things I like about let: It’s short. Even then, you don’t have to keep typing let over and over; one form can do multiple bindings.


greg
2021-2-9 15:54:28

Things I like about define: The “in” (as in "let bindings in expresions") is implicit, i.e. “the rest of the ‘block’”, “I don’t want to indent”.


greg
2021-2-9 15:54:41

Casual riffing on this: Why choose? Maybe I’d like a let+ form that takes a sequence of identifier and expression pairs, and an optional #in: expressions tail.


greg
2021-2-9 15:55:22

Like idk: (let+ x 1) (let+ y 2) (+ x y) (let+ x 1 y 2) (+ x y) (let+ x 1 y 2 #:in (+ x y))


greg
2021-2-9 15:57:01

Yeah that ends up being a little “Clojure-y” by not wrapping each binding in parens, but it’s more just to keep them all consistent. Anyway I feel like those parens are more a crutch for not having syntax-parse available. :slightly_smiling_face:


greg
2021-2-9 15:58:49

So I mean I like defines lack of indenting, but code where I am typing or reading define define define feels strangely “noisy” for an otherwise not-noisy language.


greg
2021-2-9 15:59:13

</opinions>


samth
2021-2-9 16:05:25

@greg I would again like to suggest that having racket-mode integrated with the package system would make my life better


sorawee
2021-2-9 16:07:06

you mean Emacs package system?


sorawee
2021-2-9 16:09:40

It’s on melpa, no?


sorawee
2021-2-9 16:09:40

samth
2021-2-9 16:10:16

no the racket package system


samth
2021-2-9 16:10:32

so that, for example, raco setup compiles the racket-mode code


sorawee
2021-2-9 16:10:48

ah, I see


greg
2021-2-9 16:35:37

I’ve looked at this a few times and not found a great solution, but would be happy to look at it again.


samth
2021-2-9 16:36:20

one possibility would be to use raco pkg install (or even raco link) to make Racket aware of the Racket code in racket-mode


samth
2021-2-9 16:37:07

I bring this up because my typical racket-mode experience is: 1. start emacs on a racket file 2. try to run the buffer 3. nothing happens 4. I remember that I have to run racket-mode-start-faster again


greg
2021-2-9 16:40:35

Yes, I could do a raco pkg install --link and raco pkg setup racket-mode instead of a raco make.


greg
2021-2-9 16:42:02

Just to make sure I understand your scenario, how would that help you? You’re doing an overall raco setup (everything) in these situations and so it would do Racket Mode, too?


samth
2021-2-9 16:42:16

yes, exactly


samth
2021-2-9 16:42:55

I run git pull; make, that bumps the Racket version number, the zo files for Racket mode are now out of date, Racket mode fails to start


greg
2021-2-9 16:44:03

That makes sense.


samth
2021-2-9 16:44:39

For me this is particularly problematic because it happens almost daily, because that’s how often the version has been changing recently


greg
2021-2-9 16:45:51

Yeah I do work with various Racket versions, but not as frequently as you. Also I don’t ever compile Racket Mode (except as part of testing, then immediately clean it).


greg
2021-2-9 16:45:59

Because it starts fast enough, for me.


samth
2021-2-9 16:46:09

ah, maybe I’d be happier without doing that


samth
2021-2-9 16:46:20

is there a command for removing the zos?


greg
2021-2-9 16:46:20

And if you make zos, ever, you’re kind of in that linklet version trap.


greg
2021-2-9 16:46:36

Which is the major drawback to that M-x racket-mode-start-faster command.


samth
2021-2-9 16:46:39

racket-mode-start-slower


greg
2021-2-9 16:46:45

:slightly_smiling_face:


greg
2021-2-9 16:47:29

No, it’s going to be “look under your .emacs/elpa dir for the Racket Mode files, and rm the zos”.


greg
2021-2-9 16:47:49

Or package-delete Racket Mode, and package-install it again, should work.


greg
2021-2-9 16:48:57

[[ I wish Emacs package-install had a post-install step where I could do a raco pkg install && raco setup`. But alas no AFAICT. ]]



greg
2021-2-9 16:52:04

Do that once, then never run racket-mode-start-faster, again.


samth
2021-2-9 16:52:20

yeah that’s my plan


greg
2021-2-9 16:52:26

And let me know if you’re still having problems, happy to work on it more.


samth
2021-2-9 16:53:16

racket-mode might also be a good use case for https://docs.racket-lang.org/custom-load/index.html


greg
2021-2-9 16:54:24

Yes! I starred that a couple years ago and am constantly tempted to try using that.


greg
2021-2-9 16:55:15

The times I’ve had bandwidth to try it, I’ve just had bigger fish to fry. I might loop back to that in the near future.


greg
2021-2-9 16:57:00

laurent.orseau
2021-2-9 17:18:28

Does anyone know what the error failed to get self (2) means when running a racket binary in a (non-racket) sandboxed way?



soegaard2
2021-2-9 17:24:15

Is the path length longer than 1024 characters?


laurent.orseau
2021-2-9 17:26:16

Thanks! It’s probably line 164 instead, but same thing


soegaard2
2021-2-9 17:27:07

That buffer is smaller. 256.


laurent.orseau
2021-2-9 17:27:36

It’s more likely that the executable is prevented from accessing /proc since it’s sandboxed


soegaard2
2021-2-9 17:27:58

Right. Makes sense.


laurent.orseau
2021-2-9 17:28:31

So the binary is calling /proc/self/exe to… execute itself?


soegaard2
2021-2-9 17:28:59

Just to get the path, I think.


soegaard2
2021-2-9 17:30:07

It might be a Chez thing. That would explain, not seeing it before.


laurent.orseau
2021-2-9 17:31:52

right


laurent.orseau
2021-2-9 17:33:43

Anyone knows if there could be a way around this?


soegaard2
2021-2-9 17:42:30

Btw - I wasn’t paying enough attention to the code. It actually allocates a larger buffer if needed.


laurent.orseau
2021-2-9 17:44:58

it’s a funny piece of code actually :smile: C never ceases to amaze me


soegaard2
2021-2-9 17:45:07

soegaard2
2021-2-9 17:45:47

It seems complicated.


soegaard2
2021-2-9 17:46:50

And yes - while (1) {...} just looks wrong.


capfredf
2021-2-9 18:51:20

@greg some indentation questions: is it possible to configure racket-mode to change the indentation for this code (syntax-parse stx #:datum-literals (->) [(_ (-> a b (c d)) ...) #'(values (list (list a b c) ...) (list (list a b d) ...) (list (list a b (list c d)) ...))]) to: (syntax-parse stx #:datum-literals (->) [(_ (-> a b (c d)) ...) #'(values (list (list a b c) ...) (list (list a b d) ...) (list (list a b (list c d)) ...))])


sorawee
2021-2-9 18:54:17

FWIW, if you put #:datum-literals on a new line, it will indent fine


greg
2021-2-9 18:55:20

That’s what I usually do with syntax-parse.


greg
2021-2-9 18:55:42

However you could change the indent for syntax-parse to the 'defun style.


greg
2021-2-9 18:55:51

Either globally in your init.el.


greg
2021-2-9 18:56:20

Or locally in a file, e.g. put at the end of the .rkt file: ;; Local Variables: ;; eval: (put 'syntax-parse 'racket-indent-function 'defun) ;; End:


greg
2021-2-9 18:57:02

Yes.


joel
2021-2-9 18:57:22

[whoops/superfluous/deleted!]


greg
2021-2-9 18:58:25

The file-local thing is just the usual Emacs thing for file-local value of a variable. You could think of it like a file-scope parameterize :wink:


capfredf
2021-2-9 18:58:50

Ah, thank you guys!


greg
2021-2-9 18:59:08

That could also go in a project .dir-locals.el for a project or team style of indent for custom or “standard” forms


joel
2021-2-9 18:59:55

@popa.bogdanp has a nice list of such functions/mechanism for adding them here: https://github.com/Bogdanp/.emacs.d/blob/929bff062e745ce750b9b783661c1b8202ff7961/init.el#L947


greg
2021-2-9 19:00:31

Oh I hadn’t seen that. Nice!


greg
2021-2-9 19:01:42

And the defun style is pretty much a catch-all for “any number of things on the first thing, then other lines all body-indent”.


greg
2021-2-9 19:02:16

Hmm, I wonder if that should even be a default… not sure.


greg
2021-2-9 19:04:23

Probably not a new default in Racket Mode, it would change indent for existing things.


greg
2021-2-9 19:05:31

Anyway someday the “ideal” way would be for macros to tell tools about their indent. It might entail needing some kind of external database, akin to what scribble needs. And used for other purposes, too, such as finding external references to definitions, etc.


sorawee
2021-2-9 19:11:44

laurent.orseau
2021-2-9 19:13:44

I’ll try to recompile racket after changing main.c to force it to use the generic path method USE_GENERIC_GET_SELF_PATH , which merely looks at argv[0]


laurent.orseau
2021-2-9 20:46:59

Is the ‘new’ package/collection system still using any feature from planet somehow?


samth
2021-2-9 20:47:31

No, I don’t believe so.


laurent.orseau
2021-2-9 20:48:39

thanks. My embedded executable appears to be trying to setup some things in planet/config, and I was wondering if that was needed at all


laurent.orseau
2021-2-9 20:48:55

(trying and failing due to being sandboxed)


samth
2021-2-9 20:50:16

planet is still built in, if that’s what you’re asking


samth
2021-2-9 20:50:37

i believe that code probably only looks at some environment variables


laurent.orseau
2021-2-9 20:51:26

I think it’s running collects/planet/config.rkt, which contains a call to find-system-path , which fails


laurent.orseau
2021-2-9 20:52:07

ah, it appears I can set PLTPLANETDIR to something non-empty to avoid the call


laurent.orseau
2021-2-9 20:53:12

so I guess if it’s not used it should be safe to give it some fake value


yilin.wei10
2021-2-9 21:01:49

Quick question - I’ve been reading through Racket2/Rhombus - is feedback from industrial programmers useful at all?


yilin.wei10
2021-2-9 21:04:31

I’m not entirely certain about the goals of the project; so I don’t know if my opinions on any of the issues are useful in any way.


laurent.orseau
2021-2-9 21:06:59

I’m pretty sure all opinions are welcome. It can be helpful to provide some context about yourself and how you use Racket, but the core team is very open minded about making it work for everyone, so I don’t see why your feedback would not be useful :slightly_smiling_face:


notjack
2021-2-9 21:15:01

Definitely. I’m a bit more industry-focused than most racketeers and it gets lonely :p


plragde
2021-2-9 22:04:22

I had a student using the Beginning Student language report an error of “define-struct: struct name must start with a lower case letter”. I could not replicate it. They provided a screenshot, and I noticed they were running a snapshot build from January 3. They said that was advised for Mac M1 owners. I have asked them to reinstall in the hopes that the glitch was fixed in the intervening month. But now I’m wondering how many students are running on suspect builds from the start of term. Will 8.0 support the new Macs?


mflatt
2021-2-9 22:17:51

Yes, 8.0 includes an M1-native build.


mflatt
2021-2-9 22:19:30

At first, the 7.9 Intel build did not run on M1 Macs, but then Apple improved Rosetta2. The 8.0 Intel builds also run on M1 Macs, just in case that’s ever relevant.


mflatt
2021-2-9 22:29:06

Meanwhile, it looks like the define-struct issue has not changed in the snapshot builds, so going back to v7.9 is probably the right option for your student — and we should take down the snapshot recommendation on the download page.


plragde
2021-2-9 22:30:54

Thanks, Matthew, I will advise this.


spdegabrielle
2021-2-10 00:01:24

Confusion about the goals seems common. I need to reread https://github.com/racket/rhombus-brainstorming/blob/master/README.md\|https://github.com/racket/rhombus-brainstorming/blob/master/README.md and the linked resources as I’m not sure.

My understanding of the broad project goals, and I’m not part of the racket team (I’m an outsider), is; 1. Rhombus will be implemented in Racket (Rracket isn’t going away, and will continue to evolve) 1.Rhombus will be a default alternative syntax. (I think this means you open DrRhombus the first time you get #lang rhombus 2. Rhombus will a friendly syntax version of Racket. not a lisp. and infix binary operators. 3. Rhombus intended to have the full power of racket (macros, gradual types, full interoperability with racket, native code compilation, all libs/packages and toolchain) 4. Rhombus should have the capability to freely mix racket and rhombus modules, as well as other languages in the racket ecosystem

<<I welcome correction>>

All the above is my opinion. If I have misunderstood or misinterpreted it is my fault.

My understanding is the perspective of professionals is most welcome. (I’m not a developer, but I work for a small ISV.)


notjack
2021-2-10 00:25:04

I realized that the Rhombus README doesn’t really say whether or not participation from “ordinary Racket users” is “welcomed”, so I opened a pull request https://github.com/racket/rhombus-brainstorming/pull/155


dvanhorn
2021-2-10 03:01:45

I have a student who is running 7.9 [bc] and find-exe says “can’t find Racket executable for variant 3m”. Any ideas what might cause this?


dvanhorn
2021-2-10 03:02:47

They had a homebrew installed 7.4 and installer installed 7.9 at some point which may have been causing problems


dvanhorn
2021-2-10 03:28:44

OK, resolved. Seems like the brew install got in some bad partially uninstalled state, but after removing that and going with an installer, things are better.


kellysmith12.21
2021-2-10 04:26:28

When defining a control flow abstraction, e.g. call-with-my-exception-thrower, should a fresh continuation prompt be made for each invocation of the abstraction, or is it sufficient to define a single my-exception-prompt-tag?