[racket-dev] Caching rendered icons
50 minutes ago, Neil Toronto wrote:
> On 01/12/2012 02:25 PM, Eli Barzilay wrote:
> > 20 minutes ago, Neil Toronto wrote:
> >>
> >> This is friggin' awesome. The expression
> >>
> >> (compiled-left-arrow-icon '(255 95 78) 24)
> >
> > Why is there a `compiled-' in the name?
>
> There's also a "left-arrow-icon" function, which renders it at runtime.
> The "compiled" part means:
>
> * This icon is rendered statically.
>
> * There are restrictions on the arguments.
I'd expect a single `left-arrow-icon' function, which in some cases
can be "optimized" by being pre-compiled by a macro. IOW, rename the
current `compiled-left-arrow-icon' to `left-arrow-icon', and rename
the `left-arrow-icon' to some internal name that is not exposed. Then
make it so that if it isn't possible to to pre-compile the form
statically, then it expands to the dynamic one. This way people don't
have to worry about implementation issues, and simply use the
"function". Possibly also spit out some log warning if it can't be
compiled statically, for debugging.
> > I think that it was on the r6rs list that during some
> > macro-related flame I posted something about invoking a C compiler
> > as part of a macro expansion, and someone replied that it sounded
> > crazy. (I think that the argument was that macros should really
> > only do simple `syntax-rules'-like things.)
>
> My mad-scientist advisor has actually done this. (I'm going to keep
> a tally of the number of times I write that.) I used it once to make
> building an FFI easier. What was it called... "Super C"? Not
> terribly portable, but very cool.
Yes, that's what I was referring to in that post.
A few minutes ago, Jay McCarthy wrote:
>
> I use it every year teaching PLAI so I can give little C examples.
Good idea... (But I don't do C in my course... Maybe I should, just
to make the interoperability point...)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!