Can you require the type-decl submodule?
But also the architecture isn’t set up to do this, so it might not be possible
requiring type-decl doesn’t help
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
Can you explain more what you’re trying to do?
in the end, I want transient blame from popl17
right, but how does that connect to type->sexp values
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
say there’s an untyped f that gets require/typed 2 times, as (int -> int) and (int -> string)
gets applied in the int -> int context but returns a string
I want to check that string result against the range of both types, and filter out the -> string one
type->sexp helps me send a static type to this runtime blame code
why not just use the sexp itself?
I could … but I’d need to write accessors to traverse the type, and an “sexp->predicate” function to check value matches
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.
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.
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
Is the efficient implementation trick of list? documented/published somewhere?
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.
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?
Yes, that’s right.
@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?
I think a gist linked from that issue is a good idea