[#16611] lambda, ->, haskell, and so on — Dave Thomas <dave@...>
This is one of those e-mails that I know from the start to be futile, =20=
T24gV2VkLCBBcHIgMzAsIDIwMDggYXQgMTE6MjYgUE0sIERhdmUgVGhvbWFzIDxkYXZlQHByYWdw
Hi --
David A. Black wrote:
wouldn't
On Thu, May 01, 2008 at 12:26:47PM +0900, Dave Thomas wrote:
Hi --
David A. Black wrote:
Hi --
David A. Black wrote:
On Tue, May 06, 2008 at 02:02:34AM +0900, David A. Black wrote:
Hi --
Hi --
ara howard wrote:
Hi --
Hi --
Hi --
Not to throw the whole thread into a tizzy again, but why again is:
Evan Phoenix wrote:
Hi,
Hi --
On Sun, May 11, 2008 at 9:49 AM, Nobuyoshi Nakada <nobu@ruby-lang.org>
Hi,
Hi --
Hi,
Hi,
What about "fn" or "fun", for "function"?
Hi,
Hi,
Hi --
Hi,
Hi --
On Wed, 14 May 2008, David A. Black wrote:
Hi,
how about an uppercase lambda (instead of the usual lowercase one)
Christopher Gill wrote:
Suraj N. Kurapati wrote:
Hi,
Nobuyoshi Nakada wrote:
Hi,
=20
T24gVGh1LCBNYXkgMjIsIDIwMDggYXQgNTozNyBQTSwgQmVyZ2VyLCBEYW5pZWwgPERhbmllbC5C
RXZlbiB0aG91Z2ggSSBzZWUgdGhlIHVzZWZ1bG5lc3MsIHRoYXQncyBqdXN0IHVnbHkuCgotLUpl
"Jeremy McAnally" <jeremymcanally@gmail.com> wrote on 05/22/2008 05:35:01=20
2008/5/23 <Nate_Wiger@playstation.sony.com>:
I am not sure if that fits to the thread. I have not used yet the more
Tammo Tjarks wrote:
Hi --
> assert_yin_yang -> { q += 0 }, 'it broke!', -> { q == 42 }
Hi --
>> assert_yin_yang proc{ q += 0 }, 'it broke!',
[#16627] Monotonic timeofday() — zimbatm <zimbatm@...>
Hi ruby-core.
[#16642] ruby/trunk rev 16276 broken? ib/erb.rb:429:in `initialize': wrong argument type StringScanner (expected true) (TypeError) — Kurt Stephens <ks@...>
Build crashes shortly after miniruby linkage
[#16648] Uniform RDoc markup — "Jeremy McAnally" <jeremymcanally@...>
Would there be any resistance to making the markup of the RDoc
[#16760] errors running make test — Stephen Bannasch <stephen.bannasch@...>
I updated to revision 16403 and now compiling and running ruby1.9
[#16772] The RubySpec project at rubyspec.org — Brian Ford <brixen@...>
Hi all,
[#16773] Singleton methods on Float and Bignum — Evan Phoenix <evan@...>
In 1.8 (and 1.9 likely), trying to add a singleton method to a Float
Evan Phoenix wrote:
[#16788] Ruby 1.8.7-preview3 has been released — "Akinori MUSHA" <knu@...>
Folks,
[#16791] GC heap allocation in 1.9 — Sylvain Joyeux <sylvain.joyeux@...4x.org>
While getting the latest of trunk, I stumbled on r16194.
[#16806] nil.instance_eval — ts <decoux@...>
[#16807] Embedding Ruby1.9: seg fault — Masoom <masoom.shaikh@...>
Hi,
Hi,
that means current vm is not embeddable ? by min. src I guess you mean the
Masoom wrote:
[#16812] Proposal: Subject of ruby-core ML article should include artile number — SASADA Koichi <ko1@...>
Hi,
On Tue, May 20, 2008 at 8:20 AM, SASADA Koichi <ko1@atdot.net> wrote:
Luis Lavena wrote:
[#16832] Who is responsible for Ruby license? — "Han, Kimyung" <Kimyung.Han@...>
I am trying to discuss the ruby license with anyone who is responsible
[#16834] Returning duplicate values from Dir.glob — "Vladimir Sizikov" <vsizikov@...>
Hi,
[#16839] ruby autoconf problems — "Michal Suchanek" <hramrach@...>
Hello
[#16864] removal of magical definition of name for some class definition idioms — "Robert Dober" <robert.dober@...>
Dear list
[#16884] block args w/ defaults (was Re: resolving lambda | ambiguity) — "Eric Mahurin" <eric.mahurin@...>
On Sat, May 24, 2008 at 4:06 PM, Eric Mahurin <eric.mahurin@gmail.com>
SGV5IQoKSSd2ZSB0cmllZCB5b3VyIHBhdGNoIGFuZCBoYXZlIHNvbWUgdHJvdWJsZXMuCkkgZXhw
[#16886] lambda with normal block syntax — "Eric Mahurin" <eric.mahurin@...>
This patch is an independent but related one to my previous one. It can be
Hi,
On Sun, May 25, 2008 at 8:19 PM, Nobuyoshi Nakada <nobu@ruby-lang.org>
Hi,
Hi,
Hi,
Hi,
On Mon, May 26, 2008 at 4:14 PM, Dave Thomas <dave@pragprog.com> wrote:
Hi,
On Mon, May 26, 2008 at 5:18 PM, Yukihiro Matsumoto <matz@ruby-lang.org>
Hi,
If I may, here are two entries from the ChangeLog file:
Dave Thomas wrote:
Dave Thomas wrote:
Dave Thomas wrote:
On May 27, 2008, at 12:33 PM, David Flanagan wrote:
James Gray wrote:
Dave Thomas wrote:
David Flanagan wrote:
Hi,
On 5/28/08, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
Hi,
On Sun, May 25, 2008 at 2:31 AM, Eric Mahurin <eric.mahurin@gmail.com> wrote:
[#16921] Major performance degradation on trunk — "Vladimir Sizikov" <vsizikov@...>
Hi,
[#16943] Re: [PATCH] block args w/ defaults (updated) — "Eric Mahurin" <eric.mahurin@...>
MjAwOC81LzI2IFJhZG9zs2F3IEJ1s2F0IDxyYWRlay5idWxhdEBnbWFpbC5jb20+OgoKPiBIZXkh
[#16945] Oniguruma and \p{Greek} — Dave Thomas <dave@...>
Looking at the source, I'd expect the following to work:
[#16951] Ruby 1.9 "exception reentered" — "Paul Boekholt" <p.boekholt@...>
Hi,
2008/5/27, Paul Boekholt <p.boekholt@gmail.com>:
2008/6/6, Paul Boekholt <p.boekholt@gmail.com>:
> 2008/6/6, Paul Boekholt <p.boekholt@gmail.com>:
[#16953] 1.8.6, jemalloc, sock.close problem — Christopher Thompson <cthompson@...>
Warning: This message is probably only peripherally related to Ruby!
I used to catch Errno::EINVAL when using lots of open file descriptors
[#16955] ruby-mode.el copyright assignment — Phil Hagelberg <phil@...>
Hi,
[#16979] Array.nitems replacement? — David Flanagan <david@...>
Array.nitems has just been removed from 1.9, and as near as I can make
[#16984] ZLIB for MSVC 8 - tar_input.rb — "Giancarlo F Bellido" <support@...>
I managed to install wxruby and compile zlib extension using this patch in
On May 28, 2008, at 19:48 PM, Giancarlo F Bellido wrote:
[#17010] unexpected return using define_method — Paul Brannan <pbrannan@...>
Is this a bug?
Paul Brannan wrote:
On Fri, May 30, 2008 at 06:10:25PM +0900, ts wrote:
Paul Brannan wrote:
[#17028] Ruby 1.8.7 has been released — "Akinori MUSHA" <knu@...>
Folks,
On Sun, Jun 01, 2008 at 12:25:08AM +0900, Akinori MUSHA wrote:
At Mon, 2 Jun 2008 06:37:21 +0900,
On Mon, Jun 02, 2008 at 03:46:53PM +0900, Akinori MUSHA wrote:
[#17030] Bytecode handling (compilation) extensions to Ruby 1.9 — Adam Strzelecki <ono@...>
Hello,
Hello again,
Hi,
> to_ary() convert ISeq object to Array and well known objects such as
docstrings (Was Re: Uniform RDoc markup)
Speaking of Ruby and documentation, I'd like to put in a suggestion for
document strings. Emacs Lisp and Python both have it. And in both is a
really good thing and made heavy use of it. It means at run time one can get
very specific documentation information.
I leave open where and how this information is tagged. In both Emacs Lisp
and Python this is a string that appears after the method "signature".
However
it is also possible that something could be done to use the comment before
the method definition, the same as rdoc currently uses.
Finally, I'd like to put in a plug for Paul Brannan's work in ruby-internal
for getting method signatures dynamically.
Paul Brannan to me
show details Apr 29 (6 days ago)
Reply
On Tue, Apr 29, 2008 at 11:44:37AM -0400, Rocky Bernstein wrote:
> Some things though relating to method signatures. First, in contrast to
what
> the nodewrap documentation <http://rubystuff.org/nodewrap/> seems to
> suggest, adding:
> require 'methodsig'
> is what worked for me. Is this correct, or am I doing something wrong?
Yes, that's correct, and I've fixed the webpage.
> Also, methods implemented in C give an error when trying to get the
> signature:
> NoMethodError: undefined method `argument_names' for #<Node::CFUNC
> cfnc=-1209864880, argc=-1>
Good catch. I'm not surprised by this at all.
I've entered a bug:
http://rubyforge.org/tracker/index.php?func=detail&aid=19854&group_id=313&atid=1268
> Attached is a patch that add an "impl" instance variable to the signature
> which right now can be :cfunc or nil if not a C function. I'm not sure
what
> other possibilities there are but no doubt there may be other interesting
> kinds of method implementations. For example, perhaps a "compiled" method
of
> YARV might be an interesting thing to note here.
Thank you for the patch. It needs unit tests and a few fixes before I
can commit. Do you want to do this or should I add it to my todo list?
I've put my comments below.
BTW, all my nodewrap development is now going toward ruby-internal on
github, so this patch should really be against
lib/internal/method/signature.rb rather than lib/methodsig.rb.
> Another problem I've noticed is that classtree gives an error:
> Object.classtree
> ArgumentError: cyclic include detected
> from ./classtree.rb:20:in `real_superclass'
> from ./classtree.rb:20:in `classtree'
> from ./classtree.rb:22:in `classtree'
> from ./classtree.rb:25:in `classtree'
> from (irb):2
Hmm, I wonder when this broke. This is why unit tests are important. :)
http://rubyforge.org/tracker/index.php?func=detail&aid=19853&group_id=313&atid=1268
> Unless this is a known problem that you care to elucidate on, I'll
probably
> look at this some other day.
>
> As before, thanks for the great work.
Thanks for your feedback!
> cvs diff -u
> cvs diff: Diffing .
> Index: methodsig.rb
> ===================================================================
> RCS file: /var/cvs/nodewrap/nodewrap/lib/methodsig.rb,v
> retrieving revision 1.19
> diff -u -r1.19 methodsig.rb
> --- methodsig.rb 19 Feb 2008 03:40:41 -0000 1.19
> +++ methodsig.rb 29 Apr 2008 15:13:57 -0000
> @@ -53,7 +53,11 @@
> # Return the names of the arguments this method takes, in the order in
> # which they appear in the argument list.
> def argument_names
> - return self.body.argument_names
> + if @impl == :cfunc
> + return ['argc']
This isn't right. The cfunc still has argument names; we just don't
know what they are. For a method that takes 3 args argument_names()
should return an array with 3 elements, even if those elements are just
'arg1', 'arg2,' and 'arg3'.
Also, using 'if' like this isn't OO-style. It's better to make use of
polymorphism instead. I think this can be done implementing
Node::CFUNC#local_vars, Node::CFUNC#argument_names, and the like.
> + else
> + return self.body.argument_names
> + end
> end
>
> def args_node
> @@ -83,28 +87,32 @@
> # Return a hash mapping each argument name to a description of that
> # argument.
> def arguments
> - names = self.argument_names()
> - block_arg = self.block_arg()
> -
> args = {}
> - names.each do |name|
> - args[name] = Argument.new(name, nil, nil, false, false)
> - end
> + if @impl == :cfunc
> + args['argc'] = self.body.argc
All members of the args hash should be of type Argument.
> + else
> + names = self.argument_names()
> + block_arg = self.block_arg()
> +
> + names.each do |name|
> + args[name] = Argument.new(name, nil, nil, false, false)
> + end
>
> - # Optional args
> - args_node = args_node()
> - set_optional_args(args, args_node, names)
> + # Optional args
> + args_node = args_node()
> + set_optional_args(args, args_node, names)
>
Cfunc never has optional args (as your code correctly handles),
> - # Rest arg
> - if self.rest_arg then
> - rest_name = names[rest_arg]
> - args[rest_name] = Argument.new(rest_name, nil, nil, true, false)
> - end
> + # Rest arg
> + if self.rest_arg then
> + rest_name = names[rest_arg]
> + args[rest_name] = Argument.new(rest_name, nil, nil, true, false)
> + end
But it can have a single rest arg in some cases:
irb(main):006:0> method(:puts).body
=> #<Node::CFUNC cfnc=47601960251488, argc=-1>
> - # Block arg
> - if block_arg then
> - block_name = names[block_arg]
> - args[block_name] = Argument.new(block_name, nil, nil, false, true)
> + # Block arg
> + if block_arg then
> + block_name = names[block_arg]
> + args[block_name] = Argument.new(block_name, nil, nil, false,
true)
> + end
> end
CFUNC should never have an explicit block arg (again, your code is
correct).
>
> return args
> @@ -112,17 +120,19 @@
>
> # An abstraction for a method signature.
> class Signature
> - attr_reader :origin_class, :name, :arg_names, :args
> + attr_reader :origin_class, :name, :arg_names, :args, :impl
>
> - def initialize(origin_class, name, arg_names, args)
> + def initialize(origin_class, name, arg_names, args, impl=nil)
> @origin_class = origin_class
> @name = name
> @arg_names = arg_names
> @args = args
> + @impl = impl
> end
>
> def to_s
> - return "#{@origin_class}\##{@name}(#{param_list})"
> + impl = :cfunc == @impl ? ' C function' : ''
> + return "#{@origin_class}\##{@name}(#{param_list})#{impl}"
> end
>
> def param_list
> @@ -155,13 +165,21 @@
> class Method
> include MethodSig
>
> + def initialize
> + @impl = nil
> + end
> +
> # Return a String representing the method's signature.
> def signature
> + if self.body.respond_to?(:nd_type) and 'CFUNC' ==
self.body.nd_type.name
> + @impl = :cfunc
> + end
> return Signature.new(
> attached_class(),
> method_oid().to_s,
> argument_names(),
> - arguments())
> + arguments(),
> + @impl)
> end
> end
>
> @@ -170,11 +188,15 @@
>
> # Return a String representing the method's signature.
> def signature
> + if self.body.respond_to?(:nd_type) and 'CFUNC' ==
self.body.nd_type.name
> + @impl = :cfunc
> + end
> return Signature.new(
> origin_class(),
> method_oid().to_s,
> argument_names(),
> - arguments())
> + arguments(),
> + @impl)
> end
> end
>
> @@ -386,5 +408,6 @@
>
> def foo(foo, bar=[1,2], *args, &block); end
> puts method(:foo).signature
> + puts method(:caller).signature
> end
Reply
Forward
On Mon, May 5, 2008 at 2:55 AM, Ryan Davis <ryand-ruby@zenspider.com> wrote:
>
> On May 4, 2008, at 13:37 , Phil Hagelberg wrote:
>
> "Jeremy McAnally" <jeremymcanally@gmail.com> writes:
> >
> > Would there be any resistance to making the markup of the RDoc
> > > throughout the core code more consistent?
> > >
> >
> > I would be very much in favour of seeing stronger conventions applied
> > throughout the Ruby community in the standard library, in gems, and
> > elsewhere. That's one of the things I miss from writing Emacs Lisp; it
> > has very specific guidelines[1]
> >
>
> I guess Phil brings up a good point... emacs lisp doco is a breeze to
> read.
>
> I don't mind any work making rdoc more consistent, but I'll resist any
> efforts to make it so damn structured. Do we really need to have an h4 tag
> for the parameters, options, returns, examples sections??? Let's leave
> javadoc to the java ppl and do something cleaner and clearer.
>
>
>