Hey, right I was thinking about a 'javascript' gem but somehow ended up
doubtful.
Isn't ExecJS kind of doing this "already", although I do understand it's primary goal is different it only "executes" strings of JS code, but still it's not far from it ...
I'm all for it if the gem turns out useful beyond less.rb or as you mention MacRuby finds itself usable with Less (but I doubt it ever will since v8 is doing the job and works on your production unix machine as well :)).
As I see it, moving the V8/Rhino switch knowledge into another gem, enables us to have a gemspec level 'js' gem declaration but that gem still can't have explicit deps, thus we only moved the runtime selection into somewhere else (unless we built separate versions of the gem for MRI and JRuby as fas as I understand), of course this might still turn out useful if there's multiple dependents on the gem itself.
The real reason I'm skeptical about introducing this solely due less.rb is there would be still some "if defined?(V8) / (Rhino)" code left even with the 'js' gem e.g. due the exceptions internally behaving differently in both runtimes, minimal JavaScript 1.8 compatibility hack required for Rhino to prepare the env for less.js etc.
On the other hand if the 'js' gem does have a usage beyond less.rb in a library where it can fully eliminate the JS runtime dependent code, than it might be worth upgrading less.rb code to adapt to it as well ...
K.