From: matz@... (Yukihiro Matsumoto) Date: 2002-01-16T09:55:27+09:00 Subject: Re: a wishlist for ruby 2.0 Hi, In message "Re: a wishlist for ruby 2.0" on 02/01/16, Mathieu Bouchard writes: |On Tue, 15 Jan 2002, Yukihiro Matsumoto wrote: |> |* add Thread.granularity=(v:Float),.granularity->Float, |> |* add Thread#max_stack_size=(v:Fixnum),#max_stack_size->Fixnum. |> I think these two requires specific threading implementation (or at |> least API). But I'm not sure it's possible (Windows thread has |> different model from pthread, right?) | |Last time I checked, Ruby still had its own thread system. I don't know |what you mean. Ruby 1.x does. But we're talking about Rite, right? |> |* remove Module.constants, which currently calls Object.constants as |> |Module#constants on the Object object; doing that would uncover the other |> |Module.constants, that is, Module#constants on the Module object. |> This is to show constants defined in outer modules in nest. |> Maybe it can be implemented by private Kernel#constants, just like |> local_variables. | |IMHO, it's certainly very bad that two methods with different meanings |have the same name in the same hierarchy. If you want to keep it, it |should at least be renamed. Name suggestion? |> |* Module#included_modules(recurse=true) where |> |included_modules(false) would give a list of only _direct_ inclusions. |> |This is consistent with Module#instance_methods, except for the default |> |value. |> Maybe useful. | |It's not "maybe useful", it's "very useful". This is necessary for correct |introspection. It answers to the question: which calls to Module#include |were made precisely in this object ? This is an information that Modules |keep verbatim anyway. I'm positive about this proposal. |> |* Module#instance_methods(recurse=true,visibility=:default) where |> |visibility can also take values :public, :protected and :private. |> |Object.methods(recurse=true,visibility=:default) like the above, plus |> |recurse=false would fetch only singleton methods. remove all methods |> |obsoleted by those two extensions and make them emulated by |> |"ruby1-compat.rb". |> Why do you want to remove *_instance_methods? | |I first want redundancy to be factored out, and then I want Ruby classes |to stay quick to learn, even while new functionality is added. Making |visibility a parameter will allow future method-processing methods to be |at once consistent with Ruby and non-redundant. I sometimes prefer redundancy in methods names to adding a parameter. Parameters may increase orthogonality, which may cause combination explosion. |> |* add argument to load/require to specify the context of |> |evaluation, and add to load/require/eval a way to override the default |> |line-numbering. |> I'm not sure what you mean. | |if I eval a ruby file which was unpacked from a .zip file, I'd like it to |say where it came from instead of "(eval)". (okay, it didn't have to do |precisely with _line numbering_. sorry) Do you mean you want to use the 3rd and 4th optional argument to eval? ----------------------------------------------------------- Kernel::eval eval( aString [, aBinding [file [line]]]) -> anObject ------------------------------------------------------------------------ Evaluates the Ruby expression(s) in aString. If aBinding is given, the evaluation is performed in its context. The binding may be a Binding object or a Proc object. If the optional file and line parameters are present, they will be used when reporting syntax errors. def getBinding(str) return binding end str = "hello" eval "str + ' Fred'" #=> "hello Fred" eval "str + ' Fred'", getBinding("bye") #=> "bye Fred" matz.