www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - import expression with paths

This does not compile on Windows, but does compile on Mac:

---
module main;

void main()
{
	import std.path;
	enum bar = import(`dir` ~ dirSeparator ~ `bar.txt`);
}
---

The docs say:
http://dlang.org/expression.html#ImportExpression
"Implementations may restrict the file name in order to avoid 
directory traversal security vulnerabilities. A possible 
restriction might be to disallow any path components in the file 
name."

So, I suppose it's valid code. But it's still surprising to 
encounter.
Should it not simply be disallowed completely?
Jan 30 2014