{"action":"created","issue":{"url":"https://api.github.com/repos/jscl-project/jscl/issues/242","repository_url":"https://api.github.com/repos/jscl-project/jscl","labels_url":"https://api.github.com/repos/jscl-project/jscl/issues/242/labels{/name}","comments_url":"https://api.github.com/repos/jscl-project/jscl/issues/242/comments","events_url":"https://api.github.com/repos/jscl-project/jscl/issues/242/events","html_url":"https://github.com/jscl-project/jscl/pull/242","id":170302395,"number":242,"title":"Add a MAKE-NEW operator to construct Javascript objects.","user":{"login":"brpocock","id":2066235,"avatar_url":"https://avatars.githubusercontent.com/u/2066235?v=3","gravatar_id":"","url":"https://api.github.com/users/brpocock","html_url":"https://github.com/brpocock","followers_url":"https://api.github.com/users/brpocock/followers","following_url":"https://api.github.com/users/brpocock/following{/other_user}","gists_url":"https://api.github.com/users/brpocock/gists{/gist_id}","starred_url":"https://api.github.com/users/brpocock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brpocock/subscriptions","organizations_url":"https://api.github.com/users/brpocock/orgs","repos_url":"https://api.github.com/users/brpocock/repos","events_url":"https://api.github.com/users/brpocock/events{/privacy}","received_events_url":"https://api.github.com/users/brpocock/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-10T00:29:24Z","updated_at":"2016-08-10T06:07:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jscl-project/jscl/pulls/242","html_url":"https://github.com/jscl-project/jscl/pull/242","diff_url":"https://github.com/jscl-project/jscl/pull/242.diff","patch_url":"https://github.com/jscl-project/jscl/pull/242.patch"},"body":"Usage: (make-new |ConstructorName| arg₀ … )\r\n\r\nI actually anticipated this to be way more complicated than it came out, but\r\n\r\nCL-USER> (#j:console:log (jscl::make-new |Date| 1 2 3 4 5 6))\r\n#<javascript object>\r\n\r\nDate 1901-03-03T08:05:06.000Z → inspectable object with all the methods and goodies.\r\n\r\nCL-USER> ((jscl::oget (jscl::make-new |Date| 1 2 3 4 5 6) \"getTime\"))\r\n-2172153294000"},"comment":{"url":"https://api.github.com/repos/jscl-project/jscl/issues/comments/238774078","html_url":"https://github.com/jscl-project/jscl/pull/242#issuecomment-238774078","issue_url":"https://api.github.com/repos/jscl-project/jscl/issues/242","id":238774078,"user":{"login":"davazp","id":265168,"avatar_url":"https://avatars.githubusercontent.com/u/265168?v=3","gravatar_id":"","url":"https://api.github.com/users/davazp","html_url":"https://github.com/davazp","followers_url":"https://api.github.com/users/davazp/followers","following_url":"https://api.github.com/users/davazp/following{/other_user}","gists_url":"https://api.github.com/users/davazp/gists{/gist_id}","starred_url":"https://api.github.com/users/davazp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davazp/subscriptions","organizations_url":"https://api.github.com/users/davazp/orgs","repos_url":"https://api.github.com/users/davazp/repos","events_url":"https://api.github.com/users/davazp/events{/privacy}","received_events_url":"https://api.github.com/users/davazp/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T06:07:03Z","updated_at":"2016-08-10T06:07:03Z","body":"We discussed this in #228.\r\n\r\nWe found that `  `new (g())` is perfectly valid code in Javascript. So we can actually evaluate all the arguments, including the constructor.\r\n\r\nAnd because we evaluate all the arguments, we can expose it as a function instead of a special form. The special form can be internal.\r\n\r\nWe can change the raw-builtin to be just builtin and be used like\r\n\r\n```lisp\r\n(%new constructor args-list)\r\n```\r\n\r\nNote that we need args-list to be a list, as we can't `apply` a special form.  (But there is another way)\r\n\r\nThen just\r\n\r\n```\r\n(defun make-new (constructor &rest args)\r\n  (%new constructor args))\r\n\r\n\r\nThat way we could also use it like:\r\n\r\n```lisp\r\n(mapcar #'make-new '(#j:Date #j:Other ...))\r\n```\r\n"}}
{"actor":{"display_login":"davazp"}}