From: Austin Ziegler Date: 2007-09-01T03:00:51+09:00 Subject: Re: Pragmas in Ruby 1.9 On 8/31/07, Charles Oliver Nutter wrote: > 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 > > If this ever happens, I hope it's first accompanied by a standardized > mechanism for extending (without replacing) require. Already rubygems > and rails add their own require logic, and there's complications in both > to make sure they work right. A standard way to extend require's > behavior programmatically without physically replacing require would > help guarantee future require extensions don't break old ones. Completely and totally agreed. I'd actually want to see two mechanisms for this -- one for adding new pragmas and one for overloading standard require. IMO, it'd be better if Kernel#require weren't overridable and offered a different function for require extensions. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca