Constructors accepting files
I'mma propose that functions accept files where possible, and by files I mean filepaths, Files and FileData.
The reasons why:
- It's consistent. Other constructors accept files, why don't these?
newImagedoesn't need to accept files, it could accept ImageData instead, likewise with static Sources and SoundData.
- It's useful and nice. If you want to create an object from a file, and don't have a use for the file anywhere else, why do you need to create another intermediate object? It would make the code more concise, and more... I'm not sure how to articulate it... more "you don't need to think about things other than what you're trying to do". For example, why does a lover need to know about ImageData just to set the icon?
A possible objection to this is that performance wouldn't be as good when used like this, since it's recreating Images and possibly reading from disk.
To this I would say:
- I think this sort of thing already happens with static Sources. I assume it's faster and more memory efficient to create multiple static Sources from SoundData, which you can do, but you can also create static Sources from files.
- I'm assuming it probably doesn't matter. If it ever does seriously affect performance, of course things can be optimised by creating intermediate objects, but for all the other times it's probably just nicer to create objects straight from filepaths.