Ruby’s gem and require explained with IRC wisdom

My Ruby rusts on the shelf. OK, here goes the evn, explainer:

[08:28] evn: did you know ruby 1.9 has an autoloading thing
[08:28] evn: its kind of odd
[08:28] evn: its like a lazy require
[08:28] evn: you have to set it up
[08:28] evn: but it doesnt happen until the constant gets referenced
[08:28] evn: seems like a source of subtle bugs to me
[08:28] evn: since loading some random ass module
              can be full of side effects
[08:29] olleolleolle: autoloading, huh.
[08:29] olleolleolle: I never get the new-style "gem" inclusion to work.
[08:29] olleolleolle: require_gem still works though.
[08:29] evn: thats cause 'gem' doesn't require
[08:29] evn: it just locks the version
[08:30] evn: you have to do
[08:30] evn: gem 'bob', '>= 3'
[08:30] evn: require 'bob
[08:30] evn: i think its weird too
[08:30] evn: require_gem used to do both didnt it?
[08:30] olleolleolle: In my limited mind, that should be a 
              param hash to require_gem.
[08:30] evn: overloading require is just bad in general
[08:31] evn: so much badness

Blogged with Flock

Tags: , , , ,

Published by olleolleolle

Olle is a programmer, enjoying sunny Malmö in Sweden.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.