Em 01-10-2011 11:19, SASADA Koichi escreveu:
> I made a questionnaire "What do you want to introduce in 2.0?" in my
> RubyConf2011 presentation.
>
> Followings are results from my memo.  My memo should be incomplete, so
> please complement them.
>
>
> - Cleanup syntax
> - Bytecode export
> - Symbol GC
> - Remove Proc binding
> - Macros
> - Getting parse tree
> - Getting source code
> - Cross thread Fiber migration
> - Standard Gem
> - Review all standard libraries
> - Remove obsolete one standard libraries
> - Improve Proc#curry
> - Non-blocking I/O
> - Dtrace
> - GC API (replacable GC)

A feature that I think it would be useful to consider is something like
Perl 6 main method, specially for scripts.

http://perlgeek.de/en/article/5-to-6#post_14

For instance:

rsync.rb

def main(origin, destination, *options)
puts origin, destination, options
end

ruby rsync.rb /home /bkp --skip=*.tmp --ignore-errors


Of course, if Ruby introduced some optional types, it could be useful
for automatic type checking. For the main method, for instance, we could
have something like:

sleep.rb
def main(seconds[Numeric])
sleep(seconds)
end

Calling "ruby sleep.rb twenty" could generate something like "'seconds'
should be Numeric. 'twenty' is not.".

For "ruby sleep.rb --help", we could have some alternatives:

def main(seconds[Numeric, "Seconds to sleep"]); end

Or

# @seconds: Seconds to sleep
# result: This software will sleep for @seconds seconds
def main(seconds)
end


In Perl 6, options are declared this way:

sub MAIN($origin, $destiny, $:skip = '', $:"ignore-errors") ...

Not sure about $:"ignore-errors", but I didn't see any examples
regarding an hyphen in options... The idea is more important.


This is just some brain storm, and I'm actually introducing different
features here: the main method and typed arguments and variables.

The last one is, of course, useful for other things than the main
method. It helps documenting method expected arguments types as well as
the output type.

class Dir
@[String] [](String glob) # or something like '@file_list[[String]]
[](glob[String])'
# ...
end

@Numeric count
# ...
end
end

Another thing I would like to see in Ruby is easy multi-line comments
(/* ... */), but I won't insist on this since I know this was already
considered and rejected.

Another feature would be allow Ruby to return from required files:

win32_only.rb

return unless RUBY_PLATFORM =~ /mswin32/
# lots of lines here


Sorry, if this kind of brainstorming is not what's expected from this
thread and some more solid requests are needed. But if this is time for
discussing the future of Ruby, we could discuss this topics and maybe
someone comes with better solutions to achieve these things...

Given more time, I could certainly recall more features I've thought
since I've known Ruby... :)

Cheers,

Rodrigo.