
@mflatt I tweeted about your Windows file system commit, which did prompt a suggestion from someone who works on the C# team: https://twitter.com/andygocke/status/1007500914339401729?s=19

Is it me or doesn’t Scheme respect the arithmetic-shift rules? An arithmetic shift (https://en.wikipedia.org/wiki/Arithmetic_shift) right is supposed to copy the most significant bit back to its place (e.g. #b10000010 -> #b11000001) but neither arithmetic-shift
nor bitwise-arithmetic-shift
give that result. They both replace the MSB with a 0, which is the behavior of a logical shift (https://en.wikipedia.org/wiki/Logical_shift). Why so?

@philip.mcgrath Thanks for your clarification with regards to generics
. It also clarified why define/generic
exists.

@jerome.martin.dev There’s no MSB with arbitrary-precision integers

@jerome.martin.dev I think the issue is that Wikipedia is referring to 32 or 64 bit integers

whereas Racket integers have a conceptually infinite number of bits

@samth Thanks, but I can’t make sense of that suggestion in my various situations, mostly because they involve starting with a path that some other process may have open, not starting with an open file in my process. I can try taking it to email with you and Andy.

@mflatt @samth Yeah, that’s what I was thinking too. Makes sense.

@mflatt I don’t actually know Andy, but I can reply on twitter or you can follow up on email, whichever is more helpful

@mflatt looking at the docs more, though, could you open the file and then mark it for deletion and then close it?

I haven’t tried it, but I’d expect that to be the same as DeleteFile
. I don’t think the delayed-delete-until-handles-are-closed behavior is a property of DeleteFile
specifically; I think it’s part of the filesystem design (inherited from VMS) that every file that exists must have a path, but my impression is based on second-hand sources.

Is there any contract combinator that lets me express the equivalent of (-> foo? (or/c integer? (values integer? integer?)))
? That is, I’d like a contract for a function that can return 1 or 2 values. @robby?

I don’t think so

Maybe you should make two functions?

Yes, I can do that as a workaround.

@lexi.lambda in general I think functions with interfaces like that are bad

(there are some in the standard library, which is how I know that they’re bad :)

If it makes it any better, I want to put that contract on a function in negative position, so the caller of a function can optionally omit one of the results from the function they provide to use a default value, instead. (The whole contract would be something like (-> (-> x? (or/c y? (values y? y?))) z?)
, which I think is a little less bad than providing a function to a user which returns different numbers of values.

personally, i recommend lists or vectors for this use case

Yes, I have considered using (or/c y? (list/c y? y?))
here, instead.

or even (or/c (list/c y) (list/c y y))

Returning multiple values is always a little awkward, I think, whether I use values
or list
.

I could also do something like (->i ([p (two?) (-> x? (if (or (not two?) (unsupplied-arg? two?))
y?
(values y? y?)))])
(#:two? [two? any/c])
[_ z?])
which is probably even worse of an interface. :)

Maybe I’ll just make two functions and use values
. The hardest part will just be coming up with decent, distinct names for each of them…

FWIW my suggestions was not meant to be something that says that the contract system should dictate how you set up your functions.

Merely that it may be hard to use a function that has that api

Yes, usually I would avoid such a function (and more generally, usually I would avoid values
), but in this case, I think the convenience might be okay (since the function is provided, not called, by the client).

@robby Is i t possible to run a submodule in a submodule in DrRackets ‘submodules to run’ language option?

I did it the other way around. I booked my RacketCon hotel in April [I’m never bored by any RacketCon talk], then decided yesterday to attend StrangeLoop too, based on those talks being more interesting this year than I expected. I only wish I had time for ICFP as well. STL will certainly be the place to be this September! Still have to book two earlier hotel nights, and the flights.

Awhile ago I changed the racket-run
command in Emacs racket-mode to run whatever (sub)module that point (the cursor) is within. I’ve found that pretty handy? Maybe it would be too disruptive to have Run / F5 in DrRacket start doing that. But maybe it could be a new command?

[The implementation isn’t too complicated. The Emacs Lisp code just walks up sexprs in the source, accumulating module names (that aren’t quoted or within comments, obvs), making a (submod "file.rkt" mod ...+)
form to give to dynamic-require
and module->namespace
. One wrinkle is DrR can run things that have no .rkt file yet. I’m not sure how that works with submod
and d-r
and m->n
.]

@greg the answer is it mostly doesn’t work