{"issue":{"created_at":"2011-08-04T00:36:26Z","state":"closed","updated_at":"2011-12-14T21:47:48Z","user":{"gravatar_id":"f350819e50453bd9237769a3db644f28","id":778793,"url":"https://api.github.com/users/quintesse","login":"quintesse","avatar_url":"https://secure.gravatar.com/avatar/f350819e50453bd9237769a3db644f28?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"comments":7,"body":"Non-binary-compatible named-param invocation is already done in M1. \r\n\r\n\r\n### Simple approach\r\n\r\n    // ceylon method decl\r\n    void xy(X x, Y y) {}\r\n\r\n    // java method decl\r\n    void xy(X x, Y y) {}\r\n    abstract class xy {\r\n        abstract X getX();\r\n        abstract Y getY();\r\n        final void call() { xy(getX(), getY()); }\r\n    }\r\n\r\n    // ceylon call site\r\n    foo.xy{ x = X(\"foo\"), y = Y(\"bar\")};\r\n\r\n    // java call site\r\n    foo.new xy() {\r\n        final X x = new X(\"foo\");\r\n        final Y y = new Y(\"bar\");\r\n        final X getX() { return x; }\r\n        final Y getY() { return y; }\r\n     }.call();\r\n\r\n### Invokedynamic approach\r\n\r\nWe should make named-invocation calls invokedynamic calls, which would be resolved by the method resolver at runtime into the proper calling order and get the benefit that any subsequent call would be optimised and run without the proxying.\r\n\r\nNot sure yet if that solution also works with default values, but perhaps it does if we can bypass visibility checks at runtime in the proxy and replacing missing values with the default expressions applied to the target callee object.\r\n\r\nNote: this requires:\r\n\r\n- invokedynamic to really be implemented in the compiler\r\n- to mark such named-invocation calls somehow so that they can be turned into the proper invokedynamic call by the bytecode generator\r\n- to implement the runtime proxy\r\n- a Java 7 VM\r\n\r\n### Other solutions\r\n\r\nWe should look at other languages that have this feature on the JVM, how they implement it. We might be missing much simpler solutions.","assignee":null,"id":1341504,"labels":[{"name":"FEATURE","color":"02e10c","url":"https://api.github.com/repos/ceylon/ceylon-compiler/labels/FEATURE"}],"number":44,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"Named parameter invocation and default parameters","html_url":"https://github.com/ceylon/ceylon-compiler/issues/44","closed_at":"2011-12-14T15:50:31Z","url":"https://api.github.com/repos/ceylon/ceylon-compiler/issues/44","milestone":{"created_at":"2011-08-04T00:35:20Z","state":"open","closed_issues":3,"due_on":"2011-12-31T08:00:00Z","creator":{"gravatar_id":"f350819e50453bd9237769a3db644f28","id":778793,"url":"https://api.github.com/users/quintesse","login":"quintesse","avatar_url":"https://secure.gravatar.com/avatar/f350819e50453bd9237769a3db644f28?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"number":2,"title":"M2","description":"","url":"https://api.github.com/repos/ceylon/ceylon-compiler/milestones/2","open_issues":14}},"action":"created","comment":{"created_at":"2011-12-14T21:47:48Z","updated_at":"2011-12-14T21:47:48Z","user":{"gravatar_id":"8672f1c3b11cc7390ec341ac25d7e88e","id":579974,"url":"https://api.github.com/users/gavinking","login":"gavinking","avatar_url":"https://secure.gravatar.com/avatar/8672f1c3b11cc7390ec341ac25d7e88e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"> And I'm sure Gavin forced you it's totally his type. No it's great to have this :)\r\n\r\nThat's such shit! Pinche Tako volunteered to do it 'cos he thought you were taking all the \"good stuff\". :-)","id":3151028,"url":"https://api.github.com/repos/ceylon/ceylon-compiler/issues/comments/3151028"}}