Re: Parameters considered often harmful (was: Re: [racket-users] Re: A (long) question regarding parameters and scope)

2018-08-06 Thread 'John Clements' via Racket Users
> On Aug 3, 2018, at 15:36, Alexis King wrote: > > Maybe this isn’t really a direct response to the direction this thread > has taken, but given the question proposed in the original message, I > think it’s relevant to share a particular design pattern for parameters > that seems to work well.

off-topic: on ``[racket-users]'' not added to this subthread (Was: Re: Parameters considered often harmful (was: Re: [racket-users] Re: A (long) question regarding parameters and scope))

2018-08-04 Thread Robert Girault
Why didn't [racket-users] tag get added to John Clements' message ``Parameters considered often harmful''. Was it because the tag was already contained in the subject? Is that how Google Groups avoids always adding the tag forever? I wonder why they don't use message headers to know whether it's

Re: Parameters considered often harmful (was: Re: [racket-users] Re: A (long) question regarding parameters and scope)

2018-08-03 Thread Carlos Lopez
Hello everyone, Thanks for all the responses, they have been very clarifying. I'd like to add the following for your consideration of using parameters. When using the plot package, I really like to setup common parameters using parameterize and then tweak others using the named parameters in th

Re: Parameters considered often harmful (was: Re: [racket-users] Re: A (long) question regarding parameters and scope)

2018-08-03 Thread Alexis King
Maybe this isn’t really a direct response to the direction this thread has taken, but given the question proposed in the original message, I think it’s relevant to share a particular design pattern for parameters that seems to work well. In a number of different APIs provided by Racket, a function’

Re: Parameters considered often harmful (was: Re: [racket-users] Re: A (long) question regarding parameters and scope)

2018-08-02 Thread Alex Harsanyi
On Friday, August 3, 2018 at 1:24:08 AM UTC+8, johnbclements wrote: > > I hate to turn a little question into a big one, but… are parameters the > right choice, here? It seems to me that optional parameters would be more > suitable. > Most (but not all) parameters act as default values for re

[racket-users] Re: A (long) question regarding parameters and scope

2018-08-02 Thread Alex Harsanyi
On Friday, August 3, 2018 at 6:22:10 AM UTC+8, Alex Harsanyi wrote: > > > > On Thursday, August 2, 2018 at 11:19:58 PM UTC+8, Carlos Lopez wrote: >> >> Thanks Alex! >> >> Right, so make-bm is being called from another thread and so the >> parameters are different there. >> > > The parameters sho

[racket-users] Re: A (long) question regarding parameters and scope

2018-08-02 Thread Alex Harsanyi
On Thursday, August 2, 2018 at 11:19:58 PM UTC+8, Carlos Lopez wrote: > > Thanks Alex! > > Right, so make-bm is being called from another thread and so the > parameters are different there. > The parameters should not be different. The objective of the save/restore parameters is to make sure

Parameters considered often harmful (was: Re: [racket-users] Re: A (long) question regarding parameters and scope)

2018-08-02 Thread 'John Clements' via Racket Users
I hate to turn a little question into a big one, but… are parameters the right choice, here? It seems to me that optional parameters would be more suitable. Unfortunately, I’ve been on the other side of this fence, too: parameters are vastly more convenient for implementors than adding optional

[racket-users] Re: A (long) question regarding parameters and scope

2018-08-02 Thread Carlos Lopez
Thanks Alex! Right, so make-bm is being called from another thread and so the parameters are different there. That explains why in this case, the axes are hidden: #lang racket (require plot) (plot-new-window? #t) (plot-decorations? #f) (parameterize () (plot3d (surface3d (λ (x y) (* (cos x)

[racket-users] Re: A (long) question regarding parameters and scope

2018-08-01 Thread Alex Harsanyi
Parameters don't keep their values across threads, and since the plot library needs to re-draw the plot when it is rotated or zoomed, it saves parameters for later use in a different thread, where the drawing actually happpens. There is an explicit list of parameters that are saved and restore