A new kind of dir
In R3, I can now type:
>> read %*.r
== [%del-objs.r %t.r %t1.r %test.r]
Our friend Petr is going to like that, eh? I think he requested it in 1999. Or, was it 1998?
Of course, this little change has big implications. The issue is this: is *.r a directory or a file?
Well, in reality it is neither. There is no file or dir called *.r. It is a selector specification pattern (in fact, a little domain language) that most file systems accept.
So, you ask again: Carl, as far as my script functions are concerned, is *.r a dir or a file?
Hey, don't ask me... instead, ask REBOL:
>> dir? %*.r
Ok, good to know. Not a dir.
But... what if I do this clever little check:
>> port: open %*.r
>> print port/scheme/name
Ah ha! So it is a dir!
Yes, it has to be, so that the code:
will return a list of files.
But wait, didn't I just say it wasn't a dir? So now maybe you see why it wasn't part of REBOL previously. "Is it a wave or a particle?" It depends on what you need it to be.
To help with this issue, the dir? function now allows a refinement:
>> dir?/any %*.r ; just like find/any
So, there you go.
If you think we should make this the default behavior for dir? then let me know. Maybe it should be.
But, you and I both know there are more issues lurking. This trivial little change is not so trivial. More to be said; more to be written...