From: Florian Gilcher Date: 2009-05-03T03:00:16+09:00 Subject: [ruby-core:23349] Re: What do you think about changing the return value of Kernel#require and Kernel#load to the source encoding of the required file? --Apple-Mail-54-987007088 Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable I'm actually in favour of that. The only thing natural that require could do is return information =20 about the required file. Also, setting some magic value is also a no-go in the light of recent =20 discussions about making require threadsafe. This would make it easier to warn/handle strange/unaccepted encodings. Another version would actually be to let require take a block and =20 yield the inputstream that would be required, leaving it up to the user what to do with it: check_encoding =3D ->(in){ if in.encoding !=3D "UTF-8" puts "oh my god!" end } require 'foo', &check_encoding If you build on top of that, this would be a cool option to implement =20= preprocessors... Regards, Skade On May 2, 2009, at 7:34 PM, Rafael Crivellari Saliba Schouery wrote: > I my opinion, doing that you're giving more functionality to this =20 > method than it makes sense. > I know it would be helpfull to return the encoding, but it doesn't =20 > make sense: require it's not > something naturaly that returns a encoding. > Bye! > > --- > Rafael Schouery > Autor do VidaGeek.net > http://www.ime.usp.br/~schouery > Twitter: schouery > > > On Fri, Apr 17, 2009 at 7:37 PM, Wolfgang N=E1dasi-Donner = > wrote: > Michael Neumann schrieb: > > Wolfgang N=E1dasi-Donner wrote: > You'll be able to implement that in pure Ruby. > This is possible, but my general question was, if other Ruby users =20 > want this feature, too. If "yes", why not include it into the =20 > kernel, because the information is already there. If nobody is =20 > interested in this feature, I will use code similar to that you =20 > presented. > > > But if anyhow possible try to convert all your files to UTF-8 (you =20 > probably have reasons not to do so). > I'm only talking about modules that come from other places =20 > (including gems). > > Wolfgang N=E1dasi-Donner > > > -- Florian Gilcher smtp: flo@andersground.net jabber: Skade@jabber.ccc.de gpg: 533148E2 --Apple-Mail-54-987007088 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I'm actually in favour of = that.

The only thing natural that require could = do is return information about the required file. = Also,
setting some magic value is also a no-go in the light of = recent discussions about making = require
threadsafe.

This would make = it easier to warn/handle strange/unaccepted = encodings.

Another version would actually be to = let require take a block and yield the inputstream that would = be 
required, leaving it up to the user what to do with = it:

  check_encoding =3D = ->(in){
    if in.encoding !=3D = "UTF-8"
      puts "oh my = god!"
   =  end
  }

  req= uire 'foo', &check_encoding
   =  
If you build on top of that, this would be a cool = option to implement = preprocessors...

Regards,
Skade

On May 2, 2009, at 7:34 PM, Rafael = Crivellari Saliba Schouery wrote:

I my = opinion, doing that you're giving more functionality to this method than = it makes sense.
I know it would be helpfull to return the encoding, = but it doesn't make sense: require it's not
something naturaly that = returns a encoding.
Bye!

---
Rafael = Schouery
Autor do VidaGeek.net
http://www.ime.usp.br/~schouery
Twitter: schouery


On Fri, = Apr 17, 2009 at 7:37 PM, Wolfgang N=E1dasi-Donner <ed.odanow@wonado.de> = wrote:
Michael Neumann schrieb:

Wolfgang = N=E1dasi-Donner wrote:
You'll be able to implement that in pure = Ruby.
This is possible, but my general question = was, if other Ruby users want this feature, too. If "yes", why not = include it into the kernel, because the information is already there. If = nobody is interested in this feature, I will use code similar to that = you presented.


But if anyhow = possible try to convert all your files to UTF-8 (you probably have = reasons not to do so).
I'm only talking about = modules that come from other places (including gems).

Wolfgang N=E1dasi-Donner


=


flo@andersground.net
gpg:=    533148E2
=
= --Apple-Mail-54-987007088--