{"action":"created","issue":{"url":"https://api.github.com/repos/keean/zenscript/issues/8","repository_url":"https://api.github.com/repos/keean/zenscript","labels_url":"https://api.github.com/repos/keean/zenscript/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/keean/zenscript/issues/8/comments","events_url":"https://api.github.com/repos/keean/zenscript/issues/8/events","html_url":"https://github.com/keean/zenscript/issues/8","id":178442049,"node_id":"MDU6SXNzdWUxNzg0NDIwNDk=","number":8,"title":"Subtyping","user":{"login":"shelby3","id":247731,"node_id":"MDQ6VXNlcjI0NzczMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/247731?v=4","gravatar_id":"","url":"https://api.github.com/users/shelby3","html_url":"https://github.com/shelby3","followers_url":"https://api.github.com/users/shelby3/followers","following_url":"https://api.github.com/users/shelby3/following{/other_user}","gists_url":"https://api.github.com/users/shelby3/gists{/gist_id}","starred_url":"https://api.github.com/users/shelby3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shelby3/subscriptions","organizations_url":"https://api.github.com/users/shelby3/orgs","repos_url":"https://api.github.com/users/shelby3/repos","events_url":"https://api.github.com/users/shelby3/events{/privacy}","received_events_url":"https://api.github.com/users/shelby3/received_events","type":"User","site_admin":false},"labels":[{"id":455055439,"node_id":"MDU6TGFiZWw0NTUwNTU0Mzk=","url":"https://api.github.com/repos/keean/zenscript/labels/Future%20Work","name":"Future Work","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":723,"created_at":"2016-09-21T19:34:08Z","updated_at":"2018-08-17T14:15:45Z","closed_at":null,"author_association":"NONE","body":"Union types express a subtyping relationship, but I am unclear as to whether typeclasses (i.e. Rust's traits) do?\n\nIf a `trait B` extends another `trait A` and `B` reuses the implementations of `A`, can we assign a trait object that has a bound `B` to a trait object that has a bound `A`?\n\nSeems the answer based on prior discussion is yes. But that is a subtyping relationship, which means we would need to deal with covariance on type parameters both when they are trait objects and when they are unions. Correct?\n\nPrior discussion:\nhttps://github.com/keean/zenscript/issues/6#issuecomment-248711828\nhttps://github.com/keean/zenscript/issues/1#issuecomment-248113585\nhttps://github.com/keean/traitscript/issues/2#issuecomment-248021713\nhttps://github.com/keean/zenscript/issues/1#issuecomment-248754649\n"},"comment":{"url":"https://api.github.com/repos/keean/zenscript/issues/comments/413879806","html_url":"https://github.com/keean/zenscript/issues/8#issuecomment-413879806","issue_url":"https://api.github.com/repos/keean/zenscript/issues/8","id":413879806,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzg3OTgwNg==","user":{"login":"NodixBlockchain","id":29275427,"node_id":"MDQ6VXNlcjI5Mjc1NDI3","avatar_url":"https://avatars2.githubusercontent.com/u/29275427?v=4","gravatar_id":"","url":"https://api.github.com/users/NodixBlockchain","html_url":"https://github.com/NodixBlockchain","followers_url":"https://api.github.com/users/NodixBlockchain/followers","following_url":"https://api.github.com/users/NodixBlockchain/following{/other_user}","gists_url":"https://api.github.com/users/NodixBlockchain/gists{/gist_id}","starred_url":"https://api.github.com/users/NodixBlockchain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NodixBlockchain/subscriptions","organizations_url":"https://api.github.com/users/NodixBlockchain/orgs","repos_url":"https://api.github.com/users/NodixBlockchain/repos","events_url":"https://api.github.com/users/NodixBlockchain/events{/privacy}","received_events_url":"https://api.github.com/users/NodixBlockchain/received_events","type":"User","site_admin":false},"created_at":"2018-08-17T14:15:45Z","updated_at":"2018-08-17T14:15:45Z","author_association":"NONE","body":"The examples i have in mind are for video games or complex CMS like wordpress.\r\n\r\nLike the simple example i can come up with is in mario bros when he eat a star, the function used when there is a collision with an enemy with change depending on if the star mode is active or not.\r\n\r\nIt's not the best example because the star mode could be stored in the player object, but it would be relevant if the star mode is a global state.\r\n\r\nThis sort of situation is ubiquitous in video game where the function to be used can depend on state outside of the objects, like depend on the level time, or the position inside of the level.\r\n\r\nFor selecting visual Fx too, like changing the rendering options which can often affect the physics and other things.\r\n\r\nBut i guess in all those case you could always come up with some bounded polymorphism, even if it can often be preferable not to have all the possible classes and fx loaded up front when the game is launched to minimze load time, memory use, and avoiding long lists.\r\n\r\nBut for the complex CMS it's more tricky to say because they use and abuse dynamic type system of the language.\r\n\r\nEven in simple system like codeigniter, the 'index' file goes like\r\n\r\n```\r\n$urls_segs = explode('/',$url);\r\n\r\n$component=$url_segs[0];\r\n$function=$url_segs[1];\r\n\r\ninclude 'components/'.$component:\r\n\r\n$$component.$$function();\r\n\r\n```\r\n\r\nI guess it would be possible for a particular site to have a bounded list of all components and modules the site is using, but it would be probably quite hard to include as well all the possible components and modules that can be added in the system. And it would not be very convenient to have to recompile the site each time a new components need to be added.\r\n\r\nBut most CMS system are quite clusterfucked too,\r\n\r\nI'm not sure how this would work out with an haskel like grammar, it's why i'm asking it :) If you say it's possible i'll take your word for it."}}
{"actor":{"display_login":"NodixBlockchain"}}