samth
2018-6-15 11:23:29

@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


jerome.martin.dev
2018-6-15 12:12:25

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?


pocmatos
2018-6-15 12:44:01

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


mflatt
2018-6-15 13:07:16

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


samth
2018-6-15 13:07:26

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


samth
2018-6-15 13:07:45

whereas Racket integers have a conceptually infinite number of bits


mflatt
2018-6-15 13:10:25

@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.


jerome.martin.dev
2018-6-15 13:11:06

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


samth
2018-6-15 13:11:10

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


samth
2018-6-15 14:00:08

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


mflatt
2018-6-15 14:06:28

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.


lexi.lambda
2018-6-15 15:31:38

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?


robby
2018-6-15 15:32:25

I don’t think so


robby
2018-6-15 15:33:00

Maybe you should make two functions?


lexi.lambda
2018-6-15 15:33:32

Yes, I can do that as a workaround.


samth
2018-6-15 15:33:40

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


samth
2018-6-15 15:34:12

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


lexi.lambda
2018-6-15 15:36:28

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.


samth
2018-6-15 15:38:15

personally, i recommend lists or vectors for this use case


lexi.lambda
2018-6-15 15:38:48

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


samth
2018-6-15 15:39:37

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


lexi.lambda
2018-6-15 15:40:37

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


lexi.lambda
2018-6-15 15:43:17

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. :)


lexi.lambda
2018-6-15 15:44:52

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…


robby
2018-6-15 15:50:18

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


robby
2018-6-15 15:50:38

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


lexi.lambda
2018-6-15 15:53:05

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).


leif
2018-6-15 19:53:54

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


gknauth
2018-6-15 21:36:59

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.


greg
2018-6-15 21:38:27

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?


greg
2018-6-15 21:40:19

[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.]


samth
2018-6-16 00:35:56

@greg the answer is it mostly doesn’t work