From: Yukihiro Matsumoto Date: 2011-10-24T14:31:46+09:00 Subject: [ruby-core:40300] Re: [ruby-trunk - Feature #5474][Assigned] keyword argument Hi, In message "Re: [ruby-core:40299] Re: [ruby-trunk - Feature #5474][Assigned] keyword argument" on Mon, 24 Oct 2011 14:12:21 +0900, Evan Phoenix writes: |> | def create_point(x, y, color = "white", size = 1) |> | p [x, y, color, size] |> | end |> | create_point(color: "red", x: 2, y: 3) |> | #=> [2, 3, "red", 1] |> |> It's Python way, and I won't take it. |What don't you like about this approach? I'd like to know so that hopefully I can formulate an alternative you would like. | |My worry about Yusuke's current proposal is that it requires a Hash be allocated on the caller side to use the feature, which makes the usage of keyword arguments much more heavyweight than normal arguments. This in turn means people will either shy away from them or use them and complain that they're too slow (which could make ruby look bad). | | - Evan It could make argument parsing much heavyweight and difficult to predict, both user POV and implementation POV. The Python argument rules are very complex comparing to other parts of the language. Besides that, as Yusuke mentioned, I think the current proposal still have much room to optimize, e.g. deferring hash allocation until really needed. matz.