Ruby – source code – coding style

Looking through the Ruby code it has the following for proc_arity:

static VALUE

proc_arity(VALUE self)

{

    int arity = rb_proc_arity(self);

    return INT2FIX(arity);

}

Interestingly, static VALUE is on a separate line – i.e. instead of something like this: static VALUE proc_arity(VALUE self)

because it helps grep the function definition. E.g. 

$ grep -n ‘^proc_arity’ *.c

or using vim:

/^proc_arity

Leave a Reply

Your email address will not be published. Required fields are marked *