E.g. calling with ->(i){ i * (2 + i / 4) } returns 'x * (2 + (x / 4))'
https://gist.github.com/cheald/6674718
https://github.com/pry/pry/wiki/Source-browsing
Or to get the source as a string:
> require 'pry'
> Nokogiri.method(:HTML).source
=> " def HTML thing, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block\n Nokogiri::HTML::Document.parse(thing, url, encoding, options, &block)\n end\n"https://bugs.ruby-lang.org/issues/7716
In fact, after 10 years of dedication, b/c of this and a few other issues (and attitudes) I don't use Ruby any more.
I work on a large Ruby software project and we've had to move away from any autoload except for very specific cases for this reason- troubleshooting autoload bugs are the WORST.
Maybe this is the reason it hasn't been looked at.
I wrote my one load system but have never been able to use it 100% with other projects b/c I could not override autoload require. Though I've begged for years Matz just keeps blowing it off.
Beyond that I've decide it's also time to step up work on my own language. Something I've always wanted to do for a while.
Crystal looks pretty interesting, statically typed Ruby with extreme type inference. Of course that begs the question, why not JRuby?
As for JS/CS, I love me some coffeescript, just a drag to debug the fat fingered typos, indentation mishaps, etc. wtf is going on moments.
A TypeScript/Coffeescript hybrid would be truly awesome.
As for JRuby, fair point, but I'd rather steer clear of Java as much as possible. I have to use Java for Android development and it makes me cry big hippo tears every day.
scala> Random.shuffle(List(1,2,3)) res7: List[Int] = List(2, 3, 1)
Scala-Android google group may be of interest: https://groups.google.com/forum/#!forum/scala-on-android
Obviously I've been converted to the static side, only client-side remains dynamic for me at present, and that's only because there's not yet a statically typed Coffeescript-like language available.
...and as far as its static typed mode introduced in version 2, written by only one person but bundled with the dynamic compiler as if it was part of the same software. is concerned. Grales doesnt use any of it and Gradle still ships with Groovy 1.x.
...and as far as a lot of other stuff about Groovy such as its lexer/parser imlemented in Antlr 2.7, two major releases behind Antlr 4, the latest version. is concerned.
The lack of static typing became an issue when I spent 6 months in the underworld (aka Grails in the v1.3 days) attempting to decipher voluminous stack traces whose origins lay somewhere deep in 10 layers of Grails MOP, far from one's reach.
Anyway, I was frustrated with Grails, deeply so; one day on the Grails user group someone mentioned Scala. Had no idea what that was, checked it out, bought the stairway book, started hacking around in the REPL and was quickly sold.
What is the course of this delay?
Is there a patch?
irb(main):001:0> RUBY_VERSION
=> "2.0.0"
irb(main):002:0> class Foo; def hello; puts "hello"; end; end
=> nil
irb(main):003:0> X = Foo.new.method(:hello)
=> #<Method: Foo#hello>
irb(main):004:0> X.class
=> Method
irb(main):005:0> class Bar; define_method(:hello, &X); end
=> #<Proc:0x007f93d087a2d8 (lambda)>
irb(main):006:0> Bar.new.hello
hello
=> nil
http://bugs.ruby-lang.org/issues/2080