On 01/29/2011 11:09 AM, Vít Ondruch wrote:
> Well glob should behave on Windows by Windows conventions and on Unix by
> Unix conventions. It is like if you will insist that file creation has
> to behave the same way on Unix as on Windows. See my previous example.

Where possible, Ruby scripts should see *Ruby* as the platform, not
Linux, not OSX, and not Windows.  Obviously, there will be times when
Ruby can't cover the gaps between systems or where people want/need to
do something in a platform specific way (play with the Windows registry
much?), and Ruby should support addressing those needs.  However,
globbing is one of those cases where Ruby can offer a consistent
implementation with relative ease.

> Another example: Dir.glob 'bla\*' is ultimately something different on
> Unix and Windows. I am not sure how would you like to workaround this ....

Again, my argument is that Windows globbing should be disregarded
entirely within Ruby.  Windows globbing is implemented in the cmd shell,
and Ruby has no obligation to emulate that.  The only reason there is
confusion here is because the Windows implementation is just close
enough to the Ruby implementation to fool people into thinking that the
two are actually or should be equivalent when they are definitely and
sometimes dangerously not.

As a writer of cross platform Ruby scripts, I absolutely hate it when I
have to go out of my way to handle equivalent tasks in platform specific
ways.  It increases my support and testing burden considerably, so I
much prefer that my platform (Ruby in this case) handles the differences
for me whenever feasible.  As far as globbing goes, a consistent
implementation allows me to focus more on my application logic than
coding platform specific guards that rework my globs for every platform
that has a variance.

I guess I could summarize all of this by saying that Ruby is not the cmd
shell, so don't try to treat it as such. :-)

-Jeremy