Open KotlinIsland opened 1 year ago
How and why would you do this? Python programs aren't always (probably not even most of the time) developed in the same working directory or even on the same system on which they're supposed to be executed. Files – especially their content – seem inherently non-static to me.
files are certainly not always static, but sometimes they are, so it would be useful to have them statically checked in those cases.
it would be optional, perhaps specifying a generic would make it statically checked:
a = Path["foo.txt"]() # generic could be reified using basedtyping.ReifiedGeneric
but normal paths would not be checked:
a = Path("foo.txt")
typescript for example allows you to import json files and have them checked at compiletime:
// config.json
{
"foo": 1
}
import config from './config.json'
config.bar // error
What about StaticPath
?
Checking if files exist statically would be useful
Expanding on this we could even statically get the content of the files: