From: Charles O Nutter Date: 2006-08-01T04:01:06+09:00 Subject: Re: Does Ruby need a "line separator" class? ------=_Part_32175_23012026.1154372462832 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/31/06, Wes Gamble wrote: > > I was thinking about this a little more. > > Why wouldn't JRuby just take advantage of the Java runtime's > normalization facility in this case, using the JVM's notion of "newline" > on the particular platform to handle I/O? > > Is the JRuby issue that only _some_ of the code that is doing I/O is > pure Java and some other set of the code is Ruby so that trying to > always use the JVM "line separator" concept won't work? > The issues get complicated, but the biggest underlying issue is that we can't easily look like unix on unix and windows on windows because Java looks basically the same everywhere...that is except for crap specific to unix and windows. If we pretend to be one or the other all the time, then the other platform breaks. If we try to emulate both, we run into things where we simply can't do it...we can act like both unix and windows for some things but not others. Ultimately we try to normalize things to some amorphous "java" platform, but then Ruby has no idea what we're talking about and falls back on either windows or unix behavior. We've mostly been able to trick Ruby into doing the right things on different platforms, and this will probably work the same way. It's just a matter of figuring out where newlines get normalized, normalizing them ourselves to something appropriate internally for Java on platform X, and then handling the conversion of that normalized format back out to the platform again. Figuring out exactly what happens to \r\n everywhere it's encountered within Windows-based C Ruby will help us figure out where the in/out has to happen. -- Contribute to RubySpec! @ www.headius.com/rubyspec Charles Oliver Nutter @ headius.blogspot.com Ruby User @ ruby.mn JRuby Developer @ www.jruby.org Application Architect @ www.ventera.com ------=_Part_32175_23012026.1154372462832--