To summarise briefly, I have mentioned:
- Threading support
- C/Cpp style operators
- Use of Curly braces/indentation to identify scope
- Ruby on .Net
- Currying of methods / partial evaluations
- Auto initialisation of variables
I tried to post a comment on your site but I keep getting
Server Error in ‘/’ Application.
Here’s what I was trying to send:
I wish ruby had real threads. The threading support currently provided
is really sad.
This is being worked on for Rite. Green threads aren’t that bad anyway,
they’re still very useful and are more portable (they work even on
DOS). But Rite will have native threads too.
I wish ruby had ++, --, += and that whole class of operators.
You can find a lot of postings about ++ and – in ruby-talk, so I’m not
going to repeat that here. As for +=, once you define + you get += for
free, and a += b will always mean a = a + b. Same with other OP= things.
Use of Curly Braces { }
You could toy with a code filter (preprocessor) to try that, especially
if you want to try significant indentation too.
I rather like the fact that blocks can be spotted easily at the moment.
Auto Initialization of variables
When I write code like this
sum = 0
10.times{|n| sum = sum + n }
having sum be auto-initialized to 0 is evil. Should it be 0, ‘’,
, {}? How would Ruby know?
In Ruby 2.0, you’ll be able to do
10.times{|n| (sum ||= 0) += n }
puts “Sum is #{sum}”
due to the new rules for block variables.
as for
10.times{|n| sum<0> += n; prod<1> *= n; }
there’s no need to import clumsy syntax into Ruby IMHO.
Currying of Methods and Partial Evaluations
add = lambda{|x,y| x + y }
=> #Proc:0x401fb358@:1(irb)
def curry(proc, *args); lambda{|a| proc.call((args+a))} end
=> nil
add10 = curry(add, 10); add2 = curry(add, 2)
=> #Proc:0x401f5a0c@:2(irb)
add10[1]
=> 11
add2[1]
=> 3
This could be done on methods too (without having to reify them with
method(:meth)) if parens. were needed (as in Python) to actually
do the method call. See
http://onestepback.org/index.cgi/Tech/Ruby/PythonAndRuby.rdoc.
···
On Wed, Apr 21, 2004 at 08:07:39PM +0900, James, Roshan (Cognizant) wrote:
–
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
And Bruce is effectively building BruceIX
– Alan Cox