hazemalhalabi
2020-2-25 14:14:54

@hazemalhalabi has joined the channel


greg
2020-2-25 14:23:01

Not urgent but if anyone involved with lindenmayer/turtle — e.g. @robby @florence @dan @stamourv ? — could point me in the right direction I’d be grateful: https://github.com/greghendershott/racket-mode/issues/430#issuecomment-590887988


florence
2020-2-25 14:26:12

IIRC lindenmayer sticks the actual executino of the l-system into the main submodule. are you running that?


robby
2020-2-25 14:27:24

DrRacket makes a special port where port-write-special recognizes snips it gets


robby
2020-2-25 14:28:13

Setting the print handler is a different way and I can no longer recall the trade offs between them


greg
2020-2-25 14:28:46

The print-handler is a trick I originally learned from Geiser mode for Emacs.


greg
2020-2-25 14:29:33

It’s pretty handy in non-GUI envs like Emacs or Vim or whatever, given file/convertible, and riding on the idea that module-begin prints values.


greg
2020-2-25 14:29:52

But I can imagine it would have drawbacks in DrRacket.


robby
2020-2-25 14:30:15

No I don’t agree with that


robby
2020-2-25 14:30:37

I think that the port handler approach will work fine in emacs


robby
2020-2-25 14:31:30

The pint is that you are in control of the initial environment of the program you are running and there are different ways to shape that environment that lead to different sets of things working well.


robby
2020-2-25 14:31:48

I went through many many of them a long time and ended up with the current set.


robby
2020-2-25 14:32:14

But the place you are displaying the output does not seem relevant in a deep way for choosing between them


robby
2020-2-25 14:32:43

What is relevant is what kinds of customizations affect the program’s behavior and how general you can be in supporting various printouts.


robby
2020-2-25 14:32:52

(Eom)


greg
2020-2-25 14:33:58

When you say port-write-special recognizes snips. Does using a snip imply needing to require racket/gui/base?


robby
2020-2-25 14:35:30

Ah good point. I forget the answer to this question but I do agree that racket/GUI/base dependency issues are a thing for emacs mode in a way that affects drr less


robby
2020-2-25 14:35:49

Also when I wrote snip I wrote wrong.


robby
2020-2-25 14:36:24

If lindenmayer uses snips and exploits drr’s security hole to print nicely then that’s a bug in drr not in racket mode


robby
2020-2-25 14:38:45

But if it just sends cnvertible values via write special to the default output ports then I would say that emacs mode should be able to support that


greg
2020-2-25 14:38:51

I mean, if it turns out a port-write-special approach will handle more things like lindenmayer, if/as/when racket/gui/base is loaded anyway, then I can add that as a second method.

But it sounds like I might need to keep the first-line print-handler approach, for user programs that don’t need/want to pull in racket/gui/base. I mean, a program can produce picts without using racket/gui/base, for instance, and the status quo works for that in Racket Mode in Emacs.


greg
2020-2-25 14:39:31

Oh OK.


greg
2020-2-25 14:39:44

So look at the output port level, not the print handler.


greg
2020-2-25 14:40:12

I can look into how to do that.


robby
2020-2-25 14:40:47

I’m not seeing why the print handler vs port handler issue decision is tied to the racket/gui/base issues?


robby
2020-2-25 14:41:06

Maybe it is?


greg
2020-2-25 14:41:44

“port handler” isn’t tied, but I thought “special snip or other value” might be. When I see % at the end of a name, I always want to check. :smile:


greg
2020-2-25 14:41:58

But you already said it’s not “snips”.


greg
2020-2-25 14:42:13

I can read more and understand.


robby
2020-2-25 14:42:21

It does seem like racket mode and drracket should interpose on programs for this pinting purpose in the same way. Because so much time went into the current set of overridden handlers I’m skeptical we want to change DrRacket but I do rate “changing drracket” as better than “racket mode and drracket interposing in different ways”


robby
2020-2-25 14:42:45

I think my brain just did a wrong when I wrote snip.


robby
2020-2-25 14:42:54

I really mean “value that isn’t ascii that we want to print”


greg
2020-2-25 14:43:04

Yep.


greg
2020-2-25 14:43:09

:smile:


greg
2020-2-25 14:43:43

I haven’t had a reason to use port handlers in all these years, so I’ll read up and learn more.


greg
2020-2-25 14:44:42

Thanks for your guidance! I’ll touch base later.


robby
2020-2-25 14:47:21

Looking at the lindenmayer code, it looks like it actually uses graphics/turtles to print (non–3d)


robby
2020-2-25 14:50:45

graphics/value-turtles, I mean


robby
2020-2-25 14:50:49

and it looks like that does create a snip


robby
2020-2-25 14:51:00

but that depends only on racket/snip, it looks like?


robby
2020-2-25 14:51:07

(I’m just looking at the code not trying things out)


robby
2020-2-25 14:51:35

But maybe a graphics/value-turtles program is a better program to focus on than a lindenmayer one for trying things out.


robby
2020-2-25 14:51:40

Thanks a lot, Greg!


greg
2020-2-25 15:08:04

@florence Good catch on the main submodule. That seems to be the proximate cause here. With xerepl if you ,en the file, it does not print. Similarly Racket Mode’s racket-run, does module->namespace on the file module.


greg
2020-2-25 15:09:36

Racket Mode does let you put point inside any module form to run/enter that. Alas in this case there is no (module+ main __) apparent in the source. That’s why no image prints.


greg
2020-2-25 15:10:12

That’s orthogonal to how it prints, which was still a good discussion for @robby and me to have, and a separate to-do.


popa.bogdanp
2020-2-25 17:09:12

Sweet! Thanks!


shu--hung
2020-2-25 20:25:31

I guess it’d be good to have a way to config (and perhaps inform the user) what submodules are available and which one to run


shu--hung
2020-2-25 20:26:10

but personally I’m also always avoid running the test and main submodule when working in DrRacket


robby
2020-2-25 22:56:10

Oh that’s good to hear!