Re: [racket-users] Cannot attach submodule to namespace

2021-04-16 Thread Sage Gerard
No worries. Thank you for the help as always. On 4/16/21 2:11 PM, Matthew Flatt wrote: > Yes, attaching a module instances doesn't `require` it anywhere. > > (Sorry --- I didn't look at your program closely enough to work out > whether you meant to require it, start out with a non-empty

Re: [racket-users] Cannot attach submodule to namespace

2021-04-16 Thread Matthew Flatt
Yes, attaching a module instances doesn't `require` it anywhere. (Sorry --- I didn't look at your program closely enough to work out whether you meant to require it, start out with a non-empty namespace, or something else.) At Fri, 16 Apr 2021 18:02:47 +, Sage Gerard wrote: > Yes. The error

Re: [racket-users] Cannot attach submodule to namespace

2021-04-16 Thread Sage Gerard
Yes. The error changed to "hello: unbound identifier, also no #%app ..." for me, so I also had to add `(namespace-require (quote-module-path restricted) ns)` to get it working. Were you expecting that I had to do that too? The docs for the `make-base-*-namespace` procedures make it sound like

Re: [racket-users] Cannot attach submodule to namespace

2021-04-16 Thread Matthew Flatt
The name `'restricted` is allowed as a shorthand in `require` because `require` knows what module it's in. The `namespace-attach-module` function does not try to infer a module context from the namespace argument; it uses the namespace argument only for its registry. So, you need to use the full

[racket-users] Cannot attach submodule to namespace

2021-04-16 Thread Sage Gerard
Why does this raise "namespace-attach-module: module not declared (in the source namespace)"? I expected that the `restricted` submodule would be both declared and instantiated by the time control reached `namespace-attach-module`. (module anon racket/base   (module restricted racket/base    

[racket-users] Is it possible to write a macro that acts like namespace-set-variable-value! for implicit forms?

2021-04-16 Thread Sage Gerard
I'd like to use `eval` in terms of a restricted namespace including `#%datum` and `#%app`. For minimalism and security, I want to build that namespace starting from an empty one, without using racket/sandbox, security guards, or attaching racket/base. Under these restrictions, I would normally

Re: [racket-users] Typed Racket: type relations

2021-04-16 Thread Dominik Pantůček
I wanted to polish things a bit before starting a longer discussion, but here we go ;-) The code in question[1] is part of my work into exchanging unsafe modules which can be used either contracted or uncontracted for TR modules. The goal is to replace racket/unsafe/ops with TR to provide

Re: [racket-users] Typed Racket: type relations

2021-04-16 Thread kamist...@gmail.com
(Not experienced with typed racket) How about something like this, is there something bad about this? (fxquotient (-> Fixnum Fixnum Fixnum)) (fixnum->byte (-> Fixnum Byte)) ;; possible runtime error (fixnum->byte (fxquotient rs n)) (I don't expect a type to always snap to the narrower one

Re: [racket-users] Typed Racket: type relations

2021-04-16 Thread Sam Tobin-Hochstadt
To improve this, we'd have to extend the type of `fxquotient`, which is reasonable, but I'm not sure what the addition would be. In particular, your addition is not sound: (fxquotient 1024 2) produces 512 which is not a Byte. Sam On Thu, Apr 15, 2021 at 6:22 PM Dominik Pantůček wrote: > >

Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-16 Thread Dexter Lagan
Yes! Thank you. Dex From: Matthew Flatt Sent: Friday, April 16, 2021 3:26:19 PM To: Dexter Lagan Cc: Racket Users Subject: Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket Oh, I think I finally get it. The problem

Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-16 Thread Matthew Flatt
Oh, I think I finally get it. The problem is that the leftover amount is returned by `gen-wheels`. With scaling by `wheel-scale`, the returned leftover has been scaled --- but when the leftover is passed back to `gen-wheels` later, it gets scaled again. Applying the scale to `WHEEL_DELTA`

Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-16 Thread Dexter Lagan
Hi Matt, This works because when amt is smaller than WHEEL_DELTA, the amt value is used directly, see first branch of the cond : (cond * [((abs amt) . < . WHEEL_DELTA_S)* (case wheel-steps-mode [(one integer) amt]