[#81492] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — normalperson@...

Issue #13618 has been reported by normalperson (Eric Wong).

12 messages 2017/06/01

[ruby-core:81731] Re: [Ruby trunk Feature#13434] better method definition in C API

From: Eric Wong <normalperson@...>
Date: 2017-06-20 05:47:06 UTC
List: ruby-core #81731
nobu@ruby-lang.org wrote:
> I don't like "mini-language" which needs a parser.

OK, what about an API similar to pthread_attr_set*?

Hash#[]=

	rb_method_attr_set_required(&attr, 0);
	rb_method_attr_set_const(&attr, 0);
	rb_method_attr_set_persist(&attr, 0);
	rb_method_attr_set_required(&attr, 1);
	rb_def_method(rb_Hash, rb_hash_aset, &attr);

Maybe the above is too verbose:

	rb_method_attr_setfl(&attr, 0, RB_CONST|RB_PERSIST|RB_REQUIRED);
	rb_method_attr_setfl(&attr, 1, RB_REQUIRED);
	rb_def_method(rb_Hash, "[]=", rb_hash_aset, &attr);


For "exception: (true|false)"

	rb_method_attr_setkw_const(&attr, "exception", Qtrue);



Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread