kellysmith12.21
2020-10-10 10:14:05

Other than using contract, is there a way to attach a contract to the procedure given to a struct type’s prop:procedure property?


kellysmith12.21
2020-10-10 13:53:53

Never mind, I realized that the contract can be attached to a smart constructor.


alexknauth
2020-10-10 15:21:04

I need some help trying to implement the “chaperone” version of dict/c, on the dict-ref method variant where a failure-result is given as a normal value, not as a procedure. I would like to distinguish these two cases: (define/contract d (dict/c symbol? number?) (mutable-dict 'a #f)) (dict-ref d 'other #f) ; Case 1, key not found, returns #f as the failure-result, should passes contract (dict-ref d 'a #f) ; Case 2, key found, would return #f as the value, but should fail the contract And I need to distinguish these without calling the user’s underlying dict-ref function multiple times. My idea was to change dict-ref so it normalizes failure-results into procedures like this: (dict-ref d 'other (λ () #f)) ; Case 1, key not found, calls the failure-result procedure, passes contract (dict-ref d 'a (λ () #f)) ; Case 2, key found, does not call failure-result procedure, fails the contract When failure-result is a procedure, this is easier to distinguish because I can chaperone that procedure to determine whether it was called. However, this brings another problem with define/generic: (define/generic gen-dict-ref dict-ref) (gen-dict-ref d 'other #f) When someone uses define/generic they can get gen-dict-ref as the “raw” version that expects only a failure-result procedure, bypassing whatever wrapper I might put around the exported dict-ref to fix it.

Is there a way around this problem?


n.gimenez66
2020-10-10 20:26:47

Hi there! Anyone using neovim or vim to edit racket? I want to use the racket LSP there. There is no coc.nvim extension available. Besides, NVIM 0.5 provides support for LSP, I wonder if someone managed to configure it correctly?


n.gimenez66
2020-10-10 20:27:57

I created #vim to discuss between vim/neovim users.


notjack
2020-10-11 02:53:47

I haven’t put in the time to fully wrap my head around this but I hope you find a solution, it seems like an important problem


kellysmith12.21
2020-10-11 05:57:47

I suppose that this is more a of a history question than one of practice… Is it the case that map ought to have a universal contract attached to it, or is there some pragmatic/idiomatic reason to use the much weaker procedure? and list? contracts for the arguments?