On 5/28/09, Clifford Heath <no / spam.please.net> wrote: > Caleb Clausen wrote: >> To be endless in your own code, you must first require 'endless.rb', >> then load files which are written endlessly using Endless.load, rather >> than the usual plain vanilla load (or require). (Endless.require isn't >> written yet, sorry.) > > Ouch. But this is a good candidate for using Polyglot. Just name > your files .rbe, and when you require 'endless', it registers that > extension with Polyglot to be used with the endless loader. Then > you can just "require 'fred'", and it will endless-load "fred.rbe". This is very interesting, I could use this in RubyMacros as well. But then that brings up another issue; what if I want to use both at once? Aside from the trouble of actually getting the two to work together, how does a user specify that some particular combination of preprocessors is to be used? Extending your example, I could use .rbm for files with macros in them, but what about files without ends and with macros? .rbem? While Polyglot's extension registration system is nice, I'm wanting something more sophisticated as well. Michael Bruschkewitz wrote: (in another thread) > At breakfast I had the idea it would be possible to implement/apply it to current file it by > simply using > "require 'tool4endH8ers.rb'" or > "require 'languageConverter_pyi.rb'" or > "require 'languageConverter_BASIC.rb'" or > "require 'languageConverter_f77.rb'" or... > "require 'applySomeOtherWeirdOptions.rb'" or... > at the beginning of each file or at the beginning of main file. > I'm sure some Kernel.magic would make this possible. I'm not entirely sure, but it seems like he's saying that if you should be able to require "languageConverter_f77.rb", and then write the rest of the file in fortran. A bit far-fetched, but I like the idea of being able to declare the format up at the top of the file, perhaps with a magic comment. > Why not think about providing a mechanism which provides this possibility? Hmm, what about it, Clifford? Seems like an appropriate thing to add to Polyglot.... PS: the examples on this page got damaged somehow: http://polyglot.rubyforge.org/