christos.perivolaropo
2021-9-7 13:09:32

Is there a way to inspect from the repl what method an interface provides?


christos.perivolaropo
2021-9-7 13:10:44

is there a similar way to inspect other types (eg structs)


christos.perivolaropo
2021-9-7 13:10:46

?


samth
2021-9-7 13:23:38

Yes, see interface->method-names


christos.perivolaropo
2021-9-7 13:28:50

thanks!


christos.perivolaropo
2021-9-7 13:31:06

Hmm I am trying

> (reuqire data/monad) > (interface->method-names gen:monad) ; :53:25: gen:monad: illegal use of syntax ; in: gen:monad ; value at phase 1: #<generic-info>


markus.pfeiffer
2021-9-7 14:43:02

I believe there’s a difference between interfaces and generic interface s; an interface is an object-oriented concept defined in racket/class whereas a generic interfaceis a concept defined in racket/generic and the two are not connected


badkins
2021-9-7 14:58:14

In <https://docs.racket-lang.org/syntax/stxparse-intro.html|the syntax-parse introduction> , after adding the “distinct-bindings” syntax class the code switches from (_ (b:binding ...) body ...+) to (_ bs:distinct-bindings . body) i.e. from body ...+ to . body . This seems like a mistake since the error message changes from: ; /Users/badkins/sync/code/racket/syntax-parse/1.1.rkt:40:0: mylet: expected more terms starting with any term ; at: () ; within: (mylet ((a 1) (b 2))) ; in: (mylet ((a 1) (b 2))) to the inferior: ; /Users/badkins/sync/code/racket/syntax-parse/1.1.rkt:21:8: λ: bad syntax ; in: (λ (a b)) or am I missing something?


badkins
2021-9-7 14:59:22

It also then switches back in the next section.


sorawee
2021-9-7 15:01:57

Yeah, it should be body ...+.

I think the doc simply wants to demonstrate the distinct-bindings syntax-class, so it didn’t care about other patterns.’


badkins
2021-9-7 15:06:26

I’m finding other issues, so I think I’ll queue up some doc pull requests.


christos.perivolaropo
2021-9-7 15:23:12

hmm, and racket/generic does not seem to provide a similar function


greg
2021-9-7 15:26:53

So for Racket Mode I have a WIP multi-back-end branch that lets you use multiple back ends. (Racket Mode has an Emacs Lisp front end, and a Racket back end. The back end implements various “commands”.)


greg
2021-9-7 15:27:06

The original motivation is a neat PR https://github.com/greghendershott/racket-mode/pull/553. But for this to work properly Racket Mode needs more changes to support a remote vs. a local back end.


greg
2021-9-7 15:27:25

Also I wanted to generalize this to support any mix of local and remote back ends. (For example, maybe you want files in some project to use Racket 8.2 locally, but in some other project you need Racket 8.0, and it would be handy to work with both projects at once.) Ergo the bigger branch I’ve been working on, to explore what that would mean.


greg
2021-9-7 15:29:05

To test I’m renting a little AWS LightSail host, with just 4 GB. One thing I noticed is that certain documentation operations would result in the Linux oom-killer abending the process. I’m still thinking about this, but one thing I’m trying is to do a major GC around the ops, which seems to help: https://github.com/greghendershott/racket-mode/commit/755f1557bc474c7941aefdfaca74f84ab190085d


greg
2021-9-7 15:29:45

But it also seems kind of kludgy. So I wanted to toss it out here to see if anyone has any better ideas.


greg
2021-9-7 15:30:27

TL;DR: Is it dumb to (collect-garbage 'major) in an effort to make Racket less likely to ask the OS for more memory that it might not actually need?


christos.perivolaropo
2021-9-7 15:30:33

Hi greg, I am fakedrake on github. I did come back from my vacation finally but I forgot about the branch, sorry about. Just wanted to thank you for actually coming through with this despite my flaliness


greg
2021-9-7 15:31:06

@christos.perivolaropo Oh, hi! :slightly_smiling_face:


greg
2021-9-7 15:31:58

No worries. It was a great PR! It just pulled on a thread and before the whole sweater unraveled I needed to do a lot of thinking. :slightly_smiling_face:


samth
2021-9-7 15:57:56

I think that approach will reduce peak memory consumption


samth
2021-9-7 15:58:54

One warning: we had a serious problem in the handin-server related to forced GCs: https://github.com/racket/handin/commit/719148138c6551c66505b019de73b8ff92599f42


greg
2021-9-7 16:11:36

@samth Thanks for that feedback re peak use. I believe the handin-server situation is different, because 1. I’m not trying to impose a limit, and 2. getting oom-killed represents a failure to make progress :slightly_smiling_face: — but I’ll also reflect on that awhile and see if I have some other ideas.


samth
2021-9-7 16:25:09

Right, I don’t think that situation is like yours, but it seemed related-enough to mention