[#46930] [ruby-trunk - Bug #6825][Open] forking and pthread_cond_timedwait: Invalid argument (EINVAL) on OS X / 1.9.3-p194 — "xentronium (Mark A)" <markizko@...>

29 messages 2012/08/02

[#46974] [ruby-trunk - Bug #6830][Assigned] test failure test_constants(OpenSSL::TestConfig) [/ruby/test/openssl/test_config.rb:27] on Mac + homebrew — "kosaki (Motohiro KOSAKI)" <kosaki.motohiro@...>

17 messages 2012/08/04

[#46975] [ruby-trunk - Bug #6831][Assigned] test_getpwuid() on Mountain Lion — "kosaki (Motohiro KOSAKI)" <kosaki.motohiro@...>

12 messages 2012/08/04

[#46996] [ruby-trunk - Bug #6836][Assigned] Improve File.expand_path performance in Windows — "luislavena (Luis Lavena)" <luislavena@...>

15 messages 2012/08/04

[#47036] [ruby-trunk - Feature #6841][Open] Shorthand for Assigning Return Value of Method to Self — "wardrop (Tom Wardrop)" <tom@...>

18 messages 2012/08/07

[#47108] [ruby-trunk - Feature #6852][Open] [].transpose should behave specially — "boris_stitnicky (Boris Stitnicky)" <boris@...>

13 messages 2012/08/10

[#47138] [ruby-trunk - Bug #6861][Open] ERB::Util.escape_html is not escaping single quotes — "spastorino (Santiago Pastorino)" <santiago@...>

14 messages 2012/08/12

[#47163] [ruby-trunk - Bug #6865][Open] GC::Profiler.report might create a huge String and invoke a few GC cycles — "Eregon (Benoit Daloze)" <redmine@...>

9 messages 2012/08/13

[#47189] [ruby-trunk - Feature #6868][Open] Make `do` in block syntax optional when the block is the last argument of a method and is not an optional argument — "alexeymuranov (Alexey Muranov)" <redmine@...>

8 messages 2012/08/14

[#47243] [ruby-trunk - Feature #6895][Open] TracePoint API — "ko1 (Koichi Sasada)" <redmine@...>

27 messages 2012/08/20

[#47267] [ruby-trunk - Bug #6903][Open] [[Ruby 1.9:]] --enable-load-relative broken on systems with /lib64 — "mpapis (Michal Papis)" <mpapis@...>

11 messages 2012/08/22

[#47309] [ruby-trunk - Bug #6929][Open] Documentation for Ripper — "zzak (Zachary Scott)" <zachary@...>

16 messages 2012/08/25

[#47345] [ruby-trunk - Feature #6946][Open] FIPS support? — "vo.x (Vit Ondruch)" <v.ondruch@...>

35 messages 2012/08/28

[ruby-core:46958] Re: (Half-baked DRAFT) new `require' framework

From: Joshua Ballanco <jballanc@...>
Date: 2012-08-03 10:21:48 UTC
List: ruby-core #46958
On Tuesday, July 31, 2012 at 3:29 PM, SASADA Koichi wrote:
> Now, `require' only loads `.rb' script or `.so' files from `file system'.
> 
> (Proposal-1)
> This proposal extends the current limitation of require:
> 
> (1) load script which is represented by other than `.rb' and `.so'.
> (example: pre-compiled file, encrypted file)
> 
> (2) load script from location from other than `file system'.
> (example: require from zip archive, require over network,
> require files provided by gem efficiently using file location db)
> 
> 


I'll echo what Charles said in his response: file lookup and code loading should be handled independently. I would even go so far as to say that code loading could be made an independent API from require, enabling the loading of code from memory or, say, from a network socket. 

> == Related work
> 
> === JRuby
> 
> JRuby can require file from `.jar' (and .war file? sorry i'm not sure).
> JRuby also extends file path like VFS (virtual file system). JRuby can
> open a file in a .jar file like file system.
> (JRuby GURU: Please complement this section!)
> 
> === Rubinius
> 
> Rubinius supports AOT compile (a ruby script to a compiled file).
> (Rubinius GURU: Please complement it!)
> 
> 


=== MacRuby

MacRuby has modified require to be able to load compiled and linked object files (*.rbo) like so:

Earth: ~/Desktop > echo "def foo; puts 'foo from file a.rb'; end" > a.rb
Earth: ~/Desktop > echo "require 'a'; foo" > b.rb
Earth: ~/Desktop > macrubyc -C a.rb
Earth: ~/Desktop > macrubyc -C b.rb
Earth: ~/Desktop > rm a.rb b.rb
Earth: ~/Desktop > macruby -e "require './b'"
foo from file a.rb

But, beyond that, MacRuby can also "require" a file in a compiled, linked, dynamic library:

Earth: ~/Desktop > echo "def foo; puts 'foo from file a.rb'; end" > a.rb
Earth: ~/Desktop > echo "require 'a'; foo" > b.rb                       

Earth: ~/Desktop > macrubyc a.rb b.rb -o ab.dylib --dylib

Earth: ~/Desktop > rm a.* b.*

Earth: ~/Desktop > echo "require 'b'" > c.rb

Earth: ~/Desktop > macrubyc c.rb ab.dylib -o awesome

Earth: ~/Desktop > ./awesome
foo from file a.rb


Right now, we accomplish this with a variety of "tricks" (i.e. features of OS X's dynamic loader), but it would be nice to have a more formalized API for doing the same thing.
 

In This Thread