{"action":"created","issue":{"url":"https://api.github.com/repos/WebReflection/node-gtk/issues/9","labels_url":"https://api.github.com/repos/WebReflection/node-gtk/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/WebReflection/node-gtk/issues/9/comments","events_url":"https://api.github.com/repos/WebReflection/node-gtk/issues/9/events","html_url":"https://github.com/WebReflection/node-gtk/issues/9","id":124720057,"number":9,"title":"Implement a simple camelCase transform","user":{"login":"magcius","id":40890,"avatar_url":"https://avatars.githubusercontent.com/u/40890?v=3","gravatar_id":"","url":"https://api.github.com/users/magcius","html_url":"https://github.com/magcius","followers_url":"https://api.github.com/users/magcius/followers","following_url":"https://api.github.com/users/magcius/following{/other_user}","gists_url":"https://api.github.com/users/magcius/gists{/gist_id}","starred_url":"https://api.github.com/users/magcius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magcius/subscriptions","organizations_url":"https://api.github.com/users/magcius/orgs","repos_url":"https://api.github.com/users/magcius/repos","events_url":"https://api.github.com/users/magcius/events{/privacy}","received_events_url":"https://api.github.com/users/magcius/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2016-01-04T09:11:43Z","updated_at":"2016-01-18T18:13:54Z","closed_at":null,"body":"To ease writing JS code, one of the proposals we have is to allow users to opt-in to a camelCaseifier type module, similar to how bluebird has `promisifyAll`. One would imagine that it could look like this:\r\n\r\n```js\r\nvar Gtk = gi.importNs('Gtk');\r\nvar ngc = require('node-gtk-camelcase');\r\nngc.camelCaseifyAll(Gtk);\r\n\r\nvar window = new Gtk.Window({ iconName: \"my-application\" });\r\nwindow.setSizeRequest(800, 600);\r\nwindow.showAll();\r\n\r\nconsole.log(window.getTitle());\r\n```\r\n\r\nThis would add camel-case equivalents to all functions and properties.\r\n\r\nThe hope is that by making this explicit, it becomes less like incomprehensible magic to the community, and it can help explain edge cases e.g. signals still being named `\"notify::icon-name\"` because our module does not mangle signal names automatically -- only functions and properties.\r\n\r\nThere's also plenty of other strange kinds and edge cases to tackle. One simple example is acronym based names. Obviously, we'll only be able to automatically transform to `createHttpServer` and not `createHTTPServer`, but I'm not sure if this is natural enough for JS users. I'm not even sure the JS community has a consistent standard for this (you can see this in the amazingly named `XMLHttpRequest`)\r\n\r\nAnyway, let's build a simple, opt-in transform module to test it out."},"comment":{"url":"https://api.github.com/repos/WebReflection/node-gtk/issues/comments/172610427","html_url":"https://github.com/WebReflection/node-gtk/issues/9#issuecomment-172610427","issue_url":"https://api.github.com/repos/WebReflection/node-gtk/issues/9","id":172610427,"user":{"login":"WebReflection","id":85749,"avatar_url":"https://avatars.githubusercontent.com/u/85749?v=3","gravatar_id":"","url":"https://api.github.com/users/WebReflection","html_url":"https://github.com/WebReflection","followers_url":"https://api.github.com/users/WebReflection/followers","following_url":"https://api.github.com/users/WebReflection/following{/other_user}","gists_url":"https://api.github.com/users/WebReflection/gists{/gist_id}","starred_url":"https://api.github.com/users/WebReflection/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WebReflection/subscriptions","organizations_url":"https://api.github.com/users/WebReflection/orgs","repos_url":"https://api.github.com/users/WebReflection/repos","events_url":"https://api.github.com/users/WebReflection/events{/privacy}","received_events_url":"https://api.github.com/users/WebReflection/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T18:13:54Z","updated_at":"2016-01-18T18:13:54Z","body":"Last immediate issue going forward this way, `Gtk.Window` and `Gtkcc.Window` will be two different functions pointing a the same prototype.\r\n\r\nThis is a major source of shenanigans when it comes to this weird interoperable scenario, unless we don't wrap by default everything and eventually pollute only if required.\r\n\r\nThis, on the other hand, will mutate namespaces at runtime when required and I'm not sure it's desired."}}