From: Dave Thomas Date: 2000-12-20T11:39:14+09:00 Subject: [ruby-talk:7731] Re: Ruby enhancement request "Lyle Johnson" writes: > Because the format string for rb_scan_args() only uses single digits to > determine the number of required and optional arguments this means that you > can't have more than nine of either, right? If it's a fixed number, you can have up to 17 (the argc parameter to rb_define_method). Another approach when there are a large number of arguments is to pass trailing arguments in as a hash, using the fact that Ruby automatically gathers up key=>value pairs at the end of a parameter list: fx_create_window("fred", "Bert", 100, 200, FX::MAPPING => FIXED, FX::ICON => 'dave.ico') This would be picked up by a method with a signature such as def fx_create_window(name, title, x, y, opts) if opts[FX::MAPPING] ... This is nice if the trailing arguments are not always needed. It will also convert easily when Matz introduces keyword arguments. Just a thought. Dave