From: Gary Wright Date: 2007-08-31T23:12:34+09:00 Subject: Re: Pragmas in Ruby 1.9 On Aug 31, 2007, at 2:35 AM, David Flanagan wrote: > 2) If we need to introduce more general pragmas, I suggest > overloading Kernel.require. It should behave as usual if passed a > string. But it can handle pragmas if passed a hash. Some possible > examples (using Ruby 1.9 hash syntax): > > require encoding: "utf-8" > require unsafe: "fibers" > require thread-model: "concurrent" > require version: 1.9 > require decimal: true > require strict: true It seems to me that you can't use a method based solution to address a parse-time problem. Declaring the encoding of a source file must be done as part of the parsing process--it can't be delayed until execution time as suggested by your require-based alternative. Instead of overloading 'require' and introducing all sorts of confusion about when its effects become active (parse time or run time) it seems like this is a clear case for a new keyword with its own special behavior. Gary Wright