mflatt
2020-3-8 13:31:18

Yes, it does look like expanding syntax-case is more expensive than we’d like. I didn’t investigate that level, though, since it was obviously bad in this case at the struct-field-index level.


greg
2020-3-8 13:56:22

> I’ve found that, in the past, however, that jumping to the contract-out and then jumping from there to the actual definition is useful. For now, I implemented doing the equivalent of that, so the user does not need to. Effectively, it’s as if the user opened the proximate file (the one that adds the contract wrapper), finds the item, and does another visit-definition. That ends up on the actual define of the item. [Amusingly one example of such a scenario, and how I first noticed this, is make-traversal. :smile: It is defined in private/synchecks/traversals.rkt and provided without a contract. check-syntax.rkt requires that, and re-provides it with a contract-out.]


greg
2020-3-8 13:58:13

I think that’s a reasonable strategy for the status quo (for existing and older versions of Racket), for now.


greg
2020-3-8 14:00:11

I did start to look at how, for some future version of Racket, contract-out could provide a syntax-property (for example). But I’d need a fair bit of time to absorb and understand e.g. https://github.com/racket/racket/blob/master/racket/collects/racket/contract/private/provide.rkt


robby
2020-3-8 14:01:47

I think the thing to focus on isn’t the contract implementation but instead the protocol design and where it should live.


robby
2020-3-8 14:01:56

I can adapt contract-out no problem.


robby
2020-3-8 14:02:06

Others may want adapt other things.


robby
2020-3-8 14:02:36

Ryan may have good ideas too. I would probably try to involve him if I were going to try this.


greg
2020-3-8 14:03:24

Thanks. FWIW recently I’ve been adding more tests to the front end Emacs Lisp code. Between ELisp, the nature of Emacs UI, and timing issues when running on CI, it is not always a delightful experience, and kind of a slow slog.


robby
2020-3-8 14:03:35

I think the protocol should basically be a syntax property somewhere that says “keep going! Here is a next id to continue with”. Roughly


greg
2020-3-8 14:06:03

My starting point is usually “what is the simplest thing that could possibly work?”, and a syntax-property was the only obvious/simple thing I could imagine. But definitely interested in any possible other/better ways! And no urgent need, from my side, to rush out the first idea.


samth
2020-3-8 14:06:09

I believe that keyword application already does something similar, but I’d have to check the details


robby
2020-3-8 14:07:30

@greg : sure. But it needs to be documented and used by the clients and implemented.


greg
2020-3-8 14:07:33

Ah, so I probably underestimated the number of other “wrapping/renaming” things that might exist, and want to do similar. Got it.


robby
2020-3-8 14:08:06

Probably the best thing is to define the protocol, make it work on some dumb example and then crack the whip on someone to get contracts to also follow the protocol.


robby
2020-3-8 14:08:14

:)


greg
2020-3-8 14:09:07

Yes, I’ve been very “view from one foot away” on this lately, not zoomed out. :slightly_smiling_face:


capfredf
2020-3-9 02:39:24

Hi, everyone, I have a redex question, #lang racket (require redex) (define-language TestL [x := variable-not-otherwise-mentioned]) (define-metafunction TestL id : x -> x [(id x) x]) (define-judgment-form TestL #:mode (test123 I O) #:contract (test123 x x) [-------------- (test123 x (id x))]) (test-judgment-holds (test123 x (id x))) ;; changing (id x) to x works Why don’t meta-functions work for output patterns in (test-)judgment-holds?


capfredf
2020-3-9 02:44:19

Never mind, I’ve found the answer in the documentation: > the judgment-holds form checks whether a judgment form holds for any assignment of pattern variables in output positions.