On Mon, Aug 3, 2020 at 9:47 AM Hendrik Boom <[email protected]> wrote:
> On Sun, Aug 02, 2020 at 08:58:54PM -0700, Sorawee Porncharoenwase wrote: > > For DrRacket, it's possible via "Insert > Insert Image". It's been used > in > > HtDP. See https://htdp.org/2020-8-1/Book/part_prologue.html > > Now that's presumably something that works nicely in the DrRacket editor. > When DrRacket saves it into a file, it presumably uses some notation that > won't look like a picture in, say, emacs. > Yes, that's all correct. My knowledge isn't very deep here, but to answer the questions you asked: > But will it still be recognised as an image if I use Racket to run that > file? > Yes. The only difference is that the default printer (for example) doesn't know how to print pictures, so you will see some output like: philip$ racket image-literal.rkt (object:image% ... ...) when DrRacket would actually print the image. In principle, this is just like DrRacket's ability to print `1/3` using barred decimal notation. Can the image be used as a symbol or a constant or is it some other type > of object? > The idea, as I understand it, is that an image is a self-quoting literal datum like `42`, `"foo`", `#false`, or `#px"\\d+"`. What kind of a datum is it? Alexis has explained in your other thread why that's a difficult question. Practically, I know that image literals answer `#true` to `image?` from the `2htdp/image <https://docs.racket-lang.org/teachpack/2htdpimage.html>` library. That's the only way I can remember having worked with them, but I know they are also some other kinds of things: for example, an image literal is an instance of (a subclass of) `snip% <https://docs.racket-lang.org/gui/snip_.html>` from `racket/gui`. How is this implemented? My vague understanding is that there's some deep magic baked into `racket/gui` to support image literals, I think around `mrlib/image-core` and `mrlib/image-core-wxme`. I know there are some limitations to this approach (though I don't immediately remember what all of them are), and there have been some discussions about more general mechanism for languages to support new kinds of literal data. The most in-depth work I know of is from Lief's `#lang video <https://lang.video>`, where she's experimenting with non-linear video editor literals <https://docs.racket-lang.org/video@video-v0-2/Graphical_Non-Linear_Video_Editors.html> . Hope this helps. -Philip -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAH3z3gYs1L8Zgiapino%3DRVj3%3DX%3DmYm%3DJ_4c50KMDjESmrYC%2Brg%40mail.gmail.com.

