Maybe. The point was to do this at runtime, in the VM. I don't think all Ruby
code can be easily converted to C, nor would I want to (I like having 'eval'
work). But looking at the AST, or even the bytecode representation, this kind
of thing should be possible to figure out.
Other ideas would be to do clever runtime optimizations, or to do
optimizations that wouldn't be sane at compile time -- for instance, unroll
this:
x = 0
foo = lambda { x += 5 }
5.times do
foo.call
end
into something more like this:
x = 25
Of course, that optimization only makes sense if no one's making changes to
the Proc class, or to the scope in which that's run -- or maybe we're actually
storing 'foo' deep in some object, where it probably won't be touched, but it
might.
All of these are dangerous assumptions to make at compile time, but at
runtime, it might be reasonable to say "If any of these assumptions change,
drop the optimized version and do it the slow way."
But I am in a bit over my head, here -- I only know in theory how compilers
and VMs work; I've never actually contributed to one.
···
On Saturday 11 July 2009 08:17:54 pm Roger Pack wrote:
> if (a[0] == '3' && a[1] == NULL)
>
> I'm assuming C strings, Ruby strings might work differently, but you get
> the
> idea.
That's a great idea. Avoid ruby calls totally [NB that ruby2cext
already does this for a few things, so...maybe I can just use that].
Well, in your example, you used threads, and I'm not entirely sure how it's
possible. Pretty much by definition, processes don't share state, threads do.
There are exceptions -- shared memory, the filesystem, and other well-defined
interfaces -- but languages generally don't make these things obvious.
If you're wanting something like your example, you're wanting threads, and
you're getting all of the concurrency issues that threads have that processes
generally don't.
···
On Sunday 12 July 2009 05:41:05 pm Roger Pack wrote:
Also, can windows actually do something like
a = 3
Thread.new { # other process }
b = 3
? like shared startup state? huh? is that even possible? (just thinking
about how Python's multi process does things--it seems to allow for
something like that and I'm not sure how).
11) One thing I would really, really like would be support for proxies
which require authentication, and more specifically the Microsoft ISA
Firewall. I'd like to be able to push to gemcutter from behind that
firewall, for instance, or install gems without resorting to NTLM APS
"c:\scripts>gem install typhoeus
Building native extensions. This could take a while...
ERROR: Error installing typhoeus:
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe extconf.rb
checking for curl/curl.h in
/opt/local/include,/opt/local/include/curl,c:/ruby/include/curl,c:/ruby/include,/u
sr/include/curl,/usr/local/include/curl... no
need libcurl
... Well, it's WINDOWS... I guess I'll have to submit a patch or at
least tell them about this
On Sat, Jul 11, 2009 at 12:36 AM, Roger Pack<rogerpack2005@gmail.com> > wrote:
> Also if anybody wants to vote for it, could hack on the redcar editor or
> arcadia in the *hopes* of someday creating an editor
x = 0
foo = lambda { x += 5 }
5.times do
foo.call
end
into something more like this:
x = 25
Of course, that optimization only makes sense if no one's making changes
to
the Proc class, or to the scope in which that's run -- or maybe we're
actually
storing 'foo' deep in some object, where it probably won't be touched,
but it
might.
Good point. If there aren't any class changes you'd think a number of
optimizations would be possible.
=r
Well, in your example, you used threads, and I'm not entirely sure how
it's
possible. Pretty much by definition, processes don't share state,
threads do.
There are exceptions -- shared memory, the filesystem, and other
well-defined
interfaces -- but languages generally don't make these things obvious.
Hmm. If that's the case than perhaps the python multi process gem
*only* shares memory among processes. I suppose I could dig into its
source if needed. Maybe even reuse it!
Regardless, any +1's for my working on this one?, or am I right that it
isn't in strong demand?
Any in particular (besides ruby-debug) that aren't compat but we wish
they were?
just my current wish:
1 ruby-serialport
2 eventmachine
3 pg
4 fastri
5 rcov
Appears the only ones not compat are ruby-serialport [unfortunately I'm
not sure if I have a serial device to test it with] and webby appears
also to install and work if you patch it [1]. hpricot does appear to
compile and work on 1.9.
For ruby-debug the only current option (at least we have options) is the
built in debugger [2] or unroller [3].
Not sure if there's much to do here. Move along now.