Closed Descolada closed 3 months ago
SharedBuffer
might be nicer than default
. Sentences like the default is default could be better worded. However, given the case-sensitivity I'd rather a single word all lowercase to reduce confusion with capital letters. So, shared
or something similar?ImagePut_
prefix but once again I don't like capital letters in a case-sensitive environment.ImagePutWindow
displays a 0-sized image if I create a file mapping with the content buf := Buffer(8, 0), NumPut("int", 4, "int", 4, buf)
. If you try to use ImagePutSharedBuffer
on an already existing FileMapping you get the following error:
OpenFileMapping
call you could use "ImagePut_" (image = "SharedBuffer" ? "SharedBuffer" : image)
ImagePutSharedBuffer("https://picsum.photos/800", "MyImage")
and ImagePut internally converts it to ImagePut_MyImage
. Case-sensitivity shouldn't be an issue here, although if you wanted you could make the ImagePut version case-insensitive by converting all the provided names to lower-case...
Also, if the user is savvy enough to want to read the FileMapping directly, he can adjust his code accordingly to use the prefix. Thanks. I don't anticipate many people going the bare ImagePutSharedBuffer route without a name, so the default name shouldn't come up too much. Actually I highly doubt anyone will use this.
I propose some naming changes to the SharedBuffer option: 1) The FileMapping should hopefully be an unique enough name that there aren't naming conflicts with FileMappings created by other applications. For example the user might decide to use names such as "test" and accidentally get name conflicts. This PR proposes starting all FileMapping names with "ImagePut_" to increase uniqueness. 2) The default name should perhaps be "SharedBuffer" instead? Other ImagePut calls would be more readable, eg
ImagePutWindow("SharedBuffer", "Worker Script Test #1")
instead ofImagePutWindow("alice", "Worker Script Test #1")
.