Aleksi Niemel<aleksi.niemela / cinnober.com> writes: > # this is what I expect to work > # file.print "\00" * (1023 - (file.size-1) % 1024) Did you try file#tell? > Maybe an example enlights my view a little. There should be no need for > code like this in any libraries. OS specifics should be hidden as far as > possible from the normal developer. And these are really common > things. (cgi.rb) > > NEEDS_BINMODE = true if /WIN/ni === RUBY_PLATFORM > PATH_SEPARATOR = {'UNIX'=>'/', 'WINDOWS'=>'\\', 'MACINTOSH'=>':'} There _is_ absolutely no need for code like this in libraries, which is why you'll discover that the libraries use neither value. A Ruby program can say: f = File.new("/tmp/binfile", "wb"); And this will work on any system (DOS through Solaris). This is not an issue with self-contained Ruby programs, but rather it's an issue with the bad old world. Different systems have different path separators. It's a fact of life. Say you write a program such as print "Filename: " filename = gets and you want to extract the base name part from the filename that the user entered. How are you going to do it without knowing the path separator that the user uses? My only complaint is that the library shouldn't be reimplementing the existing File::PATH_SEPARATOR constant. > # This is how I made Ruby to eat more beautiful "obj = new Class". If you find this more beautiful, then I suspect you haven't yet had that moment of revelation when you realize how Ruby's classes, metaclasses, and objects all interact in harmony. fred = Flintstone.new is a wonderfully profound statement. It says that object construction is not special, it is not special syntax. Instead, it is simply a method call with a Class as a receiver. This is one of the major things that differentiates Ruby from pretend OO languages such as Java and C++. Why would you want to change this? > def new( klass, *args ) > if args.length != 0 > klass.new args ^ I think you're missing an asterisk Regards Dave