{"action":"opened","issue":{"url":"https://api.github.com/repos/purescript/purescript/issues/887","labels_url":"https://api.github.com/repos/purescript/purescript/issues/887/labels{/name}","comments_url":"https://api.github.com/repos/purescript/purescript/issues/887/comments","events_url":"https://api.github.com/repos/purescript/purescript/issues/887/events","html_url":"https://github.com/purescript/purescript/issues/887","id":58157522,"number":887,"title":"Discussion: What to do about the FFI?","user":{"login":"paf31","id":630306,"avatar_url":"https://avatars.githubusercontent.com/u/630306?v=3","gravatar_id":"","url":"https://api.github.com/users/paf31","html_url":"https://github.com/paf31","followers_url":"https://api.github.com/users/paf31/followers","following_url":"https://api.github.com/users/paf31/following{/other_user}","gists_url":"https://api.github.com/users/paf31/gists{/gist_id}","starred_url":"https://api.github.com/users/paf31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paf31/subscriptions","organizations_url":"https://api.github.com/users/paf31/orgs","repos_url":"https://api.github.com/users/paf31/repos","events_url":"https://api.github.com/users/paf31/events{/privacy}","received_events_url":"https://api.github.com/users/paf31/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/purescript/purescript/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/purescript/purescript/milestones/8","labels_url":"https://api.github.com/repos/purescript/purescript/milestones/8/labels","id":714450,"number":8,"title":"Ideas","description":"","creator":{"login":"paf31","id":630306,"avatar_url":"https://avatars.githubusercontent.com/u/630306?v=3","gravatar_id":"","url":"https://api.github.com/users/paf31","html_url":"https://github.com/paf31","followers_url":"https://api.github.com/users/paf31/followers","following_url":"https://api.github.com/users/paf31/following{/other_user}","gists_url":"https://api.github.com/users/paf31/gists{/gist_id}","starred_url":"https://api.github.com/users/paf31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paf31/subscriptions","organizations_url":"https://api.github.com/users/paf31/orgs","repos_url":"https://api.github.com/users/paf31/repos","events_url":"https://api.github.com/users/paf31/events{/privacy}","received_events_url":"https://api.github.com/users/paf31/received_events","type":"User","site_admin":false},"open_issues":44,"closed_issues":9,"state":"open","created_at":"2014-07-08T20:33:33Z","updated_at":"2015-02-19T01:45:04Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-02-19T01:45:04Z","updated_at":"2015-02-19T01:45:04Z","closed_at":null,"body":"I don't really like the current PureScript FFI. Its number one selling point is its simplicity, but it is, in my opinion, too simple. It allows way too many things.\r\n\r\nMy main objection is that the current FFI does not allow us to write new backends easily. Embedding huge chunks of JavaScript in our code is not an elegant solution, and it isn't portable.\r\n\r\nIt seems we have two main use cases for the FFI:\r\n\r\n- Defining foreign data types and their functions\r\n- Integrating with third party libraries\r\n\r\nAny proposal should be able to handle both of these use cases across different backends. Please give me your suggestions. Here is one:\r\n\r\n### Disallow string literals in foreign imports\r\n\r\nThe type system provides a way to talk about specifications, backends can choose their own runtime representations for the core types (as long as they are consistent), and bindings get implemented in the target language (or not, if the library is not appropriate for the given backend). This would involve splitting all our libraries into a PureScript FFI part and a JavaScript wrapper library. This is my favorite option, and has the nice benefit that we can advertise our core libraries for use outside of PureScript. It also involves relatively few changes to the compiler."}}