[racket-dev] separate plot library into gui-requiring and non-gui-requiring
I think it is worth having a plot/pict or pict/plot library that doesn't
depend on racket/GUI/base (or maybe it would be better to disentangle
snips). In any case, we have many others such libraries that turn on
avoiding racket/gui/base for exactly this reason.
Robby
On Tuesday, October 8, 2013, Neil Toronto wrote:
> On 10/08/2013 11:22 AM, Stephen Chang wrote:
>
>> Short question:
>> Is there a way to separate the gui-requiring parts of plot from the
>> non-gui-requiring parts?
>>
>> Long question:
>> Many people have expressed pleasant surprise with the plot-evaluating
>> ability of the racket pastebin Sam and I are working on.
>>
>> Most of the effort is due to scribble's nice sandbox evaluation
>> capabilities but to get it fully working, I had to hack the plot
>> library in my racket install.
>>
>> The problem is that plot uses racket/gui/base too eagerly but the
>> server has no display, resulting in a gtk initialization error. I
>> ultimately got around it by just commenting out all the gui parts of
>> plot, knowing that it would never get invoked, but obviously this is
>> an ugly solution.
>>
>> I should say that I don't think plot is at fault. The plot library
>> does lazy-require racket/gui/base but that's not good enough because
>> the laziness has to propagate to other requires that also require
>> racket/gui/base (ie plot/snip) which isnt the case. But this cannot
>> work anyways because lazy-require only works with functions and some
>> of the things imported by plot/snip are classes.
>>
>> I spent awhile trying to separate the gui-requiring parts of plot but
>> was unsuccessful. Maybe the change has to be in racket/gui/base itself
>> (related to PR 12465) I don't really know. I guess I'm just looking
>> for additional insight. Naively, slideshow/pict and 2htdp/draw do not
>> have this problem so it seemed like it should be possible.
>>
>
> Right, racket/gui/base is necessary for snips. In all the documentation
> that uses plots (plot, math, images) I've used the following hack when
> setting up the evaluators:
>
> (eval '(require (rename-in (except-in plot plot plot3d)
> [plot-pict plot]
> [plot3d-pict plot3d])))
>
> You could also rename `plot-bitmap' and `plot3d-bitmap'. (The docs use
> picts because they look better rendered in a PDF.) It wouldn't be hard to
> make a module that does that and provides everything. (Except possibly
> `plot-snip', `plot-frame', etc.)
>
> I'm reluctant to single out one way of rendering when the GUI isn't
> available. Picts look nicer when scaled, but bitmaps look nicer when
> unscaled (plots are subpixel-rendered in this case). Picts take much more
> time to redraw, but for bitmaps it's just a blit.
>
> Neil ⊥
>
> _________________________
> Racket Developers list:
> http://lists.racket-lang.org/**dev <http://lists.racket-lang.org/dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20131008/3015c880/attachment.html>