polterguy/phosphorusfive

Feature request: File paths using references/variables

blueskyleaf opened this issue · 2 comments

If we can use variables to replace actual file paths, then updating the system will be much easier. And it will have many other benefits also I think.

That way all the file paths can be declared in its own file, for example, and each file path gets its variable name, its reference, which then is used other places in the code.
So when p5 is updated, and the file names have been changed or they have been moved to new folders, it will be very quick and easy to update the file that declares all the file paths, without having to find and replace all references to the changed files throughout the source code. Since the file path will be referred to only one place, instead of a potential infinite places.

Brilliant suggestion, will come up in a release soon ...

Nice! makes so much cleaner code.
Btw, maybe the references should contain a prefix of some sort, that makes it easy to identify and differentiate between normal code and these variables.
E.g var_path1, var_path2. Or ref_path1. Etc.
If we use just any word for them, that we assign ourselves, then they will very much blend into the whole code and loose some of its magic.
I don't think either the var_ or ref_ prefix is pretty though.
Maybe not use underscore at all. Or the word variable. I'm not sure.
path.path1, maybe?

But, when we first make a function for variables, then we can use them for so much more than just paths to files. So path. may not be the best prefix. container.path1, container.value1, etc. Maybe.. Hm..