{"action":"created","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4547","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4547/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4547/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4547/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/4547","id":106409715,"number":4547,"title":"[cpp] Array<Dynamic> uses dynamic field accessors for method lookup","user":{"login":"james4k","id":766002,"avatar_url":"https://avatars.githubusercontent.com/u/766002?v=3","gravatar_id":"","url":"https://api.github.com/users/james4k","html_url":"https://github.com/james4k","followers_url":"https://api.github.com/users/james4k/followers","following_url":"https://api.github.com/users/james4k/following{/other_user}","gists_url":"https://api.github.com/users/james4k/gists{/gist_id}","starred_url":"https://api.github.com/users/james4k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/james4k/subscriptions","organizations_url":"https://api.github.com/users/james4k/orgs","repos_url":"https://api.github.com/users/james4k/repos","events_url":"https://api.github.com/users/james4k/events{/privacy}","received_events_url":"https://api.github.com/users/james4k/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-14T19:16:15Z","updated_at":"2015-09-14T19:28:19Z","closed_at":null,"body":"For the code:\r\n\r\n```haxe\r\npackage;\r\n\r\nclass Object {\r\n\tpublic function new () {}\r\n}\r\n\r\nclass Main {\r\n\tpublic static function main():Void {\r\n\t\tvar dynarray = new Array<Dynamic>();\r\n\t\tdynarray.push(0);\r\n\t\tvar objarray = new Array<Object>();\r\n\t\tobjarray.push(new Object ());\r\n\t\tvar intarray = new Array<Int>();\r\n\t\tintarray.push(0);\r\n\t}\r\n}\r\n```\r\n\r\nHaxe generates the C++ code:\r\n\r\n```cpp\r\ncpp::ArrayBase dynarray = Dynamic( Array_obj<Dynamic>::__new() );\t\r\ndynarray->__Field(HX_HCSTRING(\"push\",\"\\xda\",\"\\x11\",\"\\x61\",\"\\x4a\"), hx::paccDynamic )((int)0);\r\nArray< ::Dynamic > objarray = Array_obj< ::Dynamic >::__new();\r\n::Object tmp = ::Object_obj::__new();\r\nobjarray->push(tmp);\r\nArray< int > intarray = Array_obj< int >::__new();\r\nintarray->push((int)0);\r\n```\r\n\r\nThe obj and int arrays are there for comparison.\r\n\r\n* Is it necessary for there to be a dynamic lookup for `dynarray`'s push method?\r\n* Can `Array<Dynamic>` generate similar code to other object arrays, and avoid the Dynamic boxing and field access behaviors?"},"comment":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/comments/140183369","html_url":"https://github.com/HaxeFoundation/haxe/issues/4547#issuecomment-140183369","issue_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4547","id":140183369,"user":{"login":"james4k","id":766002,"avatar_url":"https://avatars.githubusercontent.com/u/766002?v=3","gravatar_id":"","url":"https://api.github.com/users/james4k","html_url":"https://github.com/james4k","followers_url":"https://api.github.com/users/james4k/followers","following_url":"https://api.github.com/users/james4k/following{/other_user}","gists_url":"https://api.github.com/users/james4k/gists{/gist_id}","starred_url":"https://api.github.com/users/james4k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/james4k/subscriptions","organizations_url":"https://api.github.com/users/james4k/orgs","repos_url":"https://api.github.com/users/james4k/repos","events_url":"https://api.github.com/users/james4k/events{/privacy}","received_events_url":"https://api.github.com/users/james4k/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T19:28:19Z","updated_at":"2015-09-14T19:28:19Z","body":"Not quite the same issue, but I have also wondered why `Array<Object>` generates into `Array_obj<::Object_obj *>` instead of `Array_obj<::Dynamic>`."}}