LOAD Fever Dreams: Code Embedded In Images?

I found this comment in LOAD:

; Note that code or data can be embedded in other datatypes, including
; not just text, but any binary data, including images, etc. The type
; argument can be used to control how the raw source is converted.
; Pass a /TYPE of blank or 'UNBOUND if you want embedded code or data.


I don't know what this means, so I'm taking it out to help keep focus on important features.

But the polymorphism of LOAD is something that needs to be addressed in general. It aims to be the means by which you'd get a BLOCK! of Rebol-formatted data out of a file, as well as to load a PNG file into an IMAGE!.

Also, it's currently the way you would load an extension--which is a module that happens to have some associated native code. But wouldn't that make more sense to be part of IMPORT?

Or is LOAD the way that you get a module or extension without actually bringing its definitions into scope, e.g.

m: load <some-module.r>


import <some-module.r>

This might mean that import <some-module.r> is really a shorthand for:

import load <some-module.r>

But how comfortable are we with a LOAD that's so polymorphic that if you remember to put Type: module in the header you get a module, but if you don't then you just get a BLOCK! of code?

If LOAD will load any file with any extension and do something with it, how safe is that?

Big questions, but the small thing was moving that crazy comment out of the source...

1 Like