{"action":"created","issue":{"url":"https://api.github.com/repos/gcanti/flow-runtime/issues/19","repository_url":"https://api.github.com/repos/gcanti/flow-runtime","labels_url":"https://api.github.com/repos/gcanti/flow-runtime/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/gcanti/flow-runtime/issues/19/comments","events_url":"https://api.github.com/repos/gcanti/flow-runtime/issues/19/events","html_url":"https://github.com/gcanti/flow-runtime/issues/19","id":188738635,"number":19,"title":"Project goals","user":{"login":"phpnode","id":363611,"avatar_url":"https://avatars.githubusercontent.com/u/363611?v=3","gravatar_id":"","url":"https://api.github.com/users/phpnode","html_url":"https://github.com/phpnode","followers_url":"https://api.github.com/users/phpnode/followers","following_url":"https://api.github.com/users/phpnode/following{/other_user}","gists_url":"https://api.github.com/users/phpnode/gists{/gist_id}","starred_url":"https://api.github.com/users/phpnode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpnode/subscriptions","organizations_url":"https://api.github.com/users/phpnode/orgs","repos_url":"https://api.github.com/users/phpnode/repos","events_url":"https://api.github.com/users/phpnode/events{/privacy}","received_events_url":"https://api.github.com/users/phpnode/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2016-11-11T11:17:51Z","updated_at":"2016-11-16T18:27:11Z","closed_at":null,"body":"Hey, this is a cool project! I've been working on something really similar - I even called it `flow-runtime` until I saw you'd grabbed the name :). I was wondering what your goals for the project are? Do you intend to support all of flow's features such as type parameters, object indexers, functions etc or will you keep to a smaller subset?  I think there's tremendous value in having a canonical way to represent types in JS, the ecosystem really needs a project like this."},"comment":{"url":"https://api.github.com/repos/gcanti/flow-runtime/issues/comments/261029366","html_url":"https://github.com/gcanti/flow-runtime/issues/19#issuecomment-261029366","issue_url":"https://api.github.com/repos/gcanti/flow-runtime/issues/19","id":261029366,"user":{"login":"phpnode","id":363611,"avatar_url":"https://avatars.githubusercontent.com/u/363611?v=3","gravatar_id":"","url":"https://api.github.com/users/phpnode","html_url":"https://github.com/phpnode","followers_url":"https://api.github.com/users/phpnode/followers","following_url":"https://api.github.com/users/phpnode/following{/other_user}","gists_url":"https://api.github.com/users/phpnode/gists{/gist_id}","starred_url":"https://api.github.com/users/phpnode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpnode/subscriptions","organizations_url":"https://api.github.com/users/phpnode/orgs","repos_url":"https://api.github.com/users/phpnode/repos","events_url":"https://api.github.com/users/phpnode/events{/privacy}","received_events_url":"https://api.github.com/users/phpnode/received_events","type":"User","site_admin":false},"created_at":"2016-11-16T18:27:10Z","updated_at":"2016-11-16T18:27:10Z","body":"Ah I see, I've been calling that a \"type parameter application\" but I probably have my terminology wrong. Right now \r\n```js\r\n  type Person<A> = {\r\n    name: string,\r\n    surname: A\r\n  };\r\n\r\n  type PersonType = Person<string>;\r\n```\r\n->\r\n```js\r\n  const Person = t.type(\"Person\", Person => {\r\n    const A = Person.typeParameter(\"A\");\r\n    return t.object(\r\n      t.property(\"name\", t.string()),\r\n      t.property(\"surname\", A)\r\n    );\r\n  });\r\n\r\n  const PersonType = t.type(\"PersonType\", t.ref(Person, t.string()));\r\n```\r\n\r\nThe important bit here is `t.ref()` which takes a type or value and 0 or more type instances which serve as parameters for that type. It returns a new type with those type parameters applied. \r\n\r\n> Yep https://github.com/gcanti/babel-plugin-tcomb#runtime-type-introspection\r\n\r\nWow, that is basically identical.\r\n\r\n> Mmhh this is a slippery ground, Flow likely would augment the type with a union.\r\n\r\nDoesn't it simply check that whenever a value is \"written\" to a particular type parameter, all writes to that instance must be (loosely) compatible? That's the semantics we have here. Maybe I'm misunderstanding."}}
{"actor":{"display_login":"phpnode"}}