samth
2020-6-29 11:20:51

Can you require the type-decl submodule?


samth
2020-6-29 11:22:06

But also the architecture isn’t set up to do this, so it might not be possible


ben
2020-6-29 16:00:01

requiring type-decl doesn’t help


ben
2020-6-29 16:43:22

later, I’ll try again using eval on a copy of the env-init-codes … in the meantime let me know if you have ideas for things to try


samth
2020-6-29 16:45:23

Can you explain more what you’re trying to do?


ben
2020-6-29 16:46:23

in the end, I want transient blame from popl17


samth
2020-6-29 16:46:58

right, but how does that connect to type->sexp values


ben
2020-6-29 16:47:05

so I’m trying to take a type (from a require/typed) and apply a sequence of accessors to it, to see if a runtime value matches part of that type


ben
2020-6-29 16:47:49

say there’s an untyped f that gets require/typed 2 times, as (int -> int) and (int -> string)


ben
2020-6-29 16:48:03

gets applied in the int -> int context but returns a string


ben
2020-6-29 16:48:19

I want to check that string result against the range of both types, and filter out the -> string one


ben
2020-6-29 16:49:03

type->sexp helps me send a static type to this runtime blame code


samth
2020-6-29 16:49:33

why not just use the sexp itself?


ben
2020-6-29 16:50:44

I could … but I’d need to write accessors to traverse the type, and an “sexp->predicate” function to check value matches


samth
2020-6-29 16:51:59

I continue to think that what you want is to use the exports of #%type-decl, and add more things there if it doesn’t export enough.


samth
2020-6-29 16:52:44

Using eval seems like it will never really do what you want — that code is written with the expectation that the results go into #%type-decl submodules.


ben
2020-6-29 16:54:08

ok, that helps

maybe I can make a gensym for each type that shows up in a transient check, and #%type-decl can have a map from those keys to actual types


laurent.orseau
2020-6-29 17:07:38

Is the efficient implementation trick of list? documented/published somewhere?


mflatt
2020-6-29 17:15:02

Not that I know/remember. For BC, there are several spare bits in the header, and two bits are used to represent the states “list”, “not list”, or “not yet recorded”. For CS, there are no spare bits — no header at all for pairs — so there’s a separate, on-demand, per-allocation-page bitmap to that accommodates two bits per pair. (The bits are transferred by a GC, but only when moving from a non-nursery page. So, the bits might get computed twice for a given pair, but rarely.) In either case, if list? traverses N pairs to determine a result, it sets bits to record that result for the N/2th pair.


laurent.orseau
2020-6-29 17:20:39

Thanks. I was wondering what behaviour it would have on an increasing list, such as (for/fold ([l '()] [n 0]) ([i 100000]) (values (cons i l) (if (list? l) 1 0))) Is it going to effectively record a bit for every element?


mflatt
2020-6-29 18:36:32

Yes, that’s right.


maueroats
2020-6-29 20:34:09

@samth Before I gave up on <https://github.com/racket/typed-racket/issues/496|making max and min require one argument> , I wrote up the changes needed to get all of the packages in the basic Racket distribution to compile with that requirement. Is there anywhere it would be good to put that information? Or just dump it in <https://gist.github.com/maueroats/1780fcd33a3eace3a687299365293973|a gist like this> and (maybe?) link it from the issue? Three different repositories being changed (math, plot, typed-racket) made it pretty clear it was a no-go but maybe someday a student would like the starter info?


samth
2020-6-29 20:34:31

I think a gist linked from that issue is a good idea