{"action":"created","issue":{"url":"https://api.github.com/repos/tbeu/ModelicaSpecification/issues/113","repository_url":"https://api.github.com/repos/tbeu/ModelicaSpecification","labels_url":"https://api.github.com/repos/tbeu/ModelicaSpecification/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/tbeu/ModelicaSpecification/issues/113/comments","events_url":"https://api.github.com/repos/tbeu/ModelicaSpecification/issues/113/events","html_url":"https://github.com/tbeu/ModelicaSpecification/issues/113","id":372144727,"node_id":"MDU6SXNzdWUzNzIxNDQ3Mjc=","number":113,"title":"subtypes of functions","user":{"login":"modelica-trac-importer","id":22202507,"node_id":"MDQ6VXNlcjIyMjAyNTA3","avatar_url":"https://avatars1.githubusercontent.com/u/22202507?v=4","gravatar_id":"","url":"https://api.github.com/users/modelica-trac-importer","html_url":"https://github.com/modelica-trac-importer","followers_url":"https://api.github.com/users/modelica-trac-importer/followers","following_url":"https://api.github.com/users/modelica-trac-importer/following{/other_user}","gists_url":"https://api.github.com/users/modelica-trac-importer/gists{/gist_id}","starred_url":"https://api.github.com/users/modelica-trac-importer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modelica-trac-importer/subscriptions","organizations_url":"https://api.github.com/users/modelica-trac-importer/orgs","repos_url":"https://api.github.com/users/modelica-trac-importer/repos","events_url":"https://api.github.com/users/modelica-trac-importer/events{/privacy}","received_events_url":"https://api.github.com/users/modelica-trac-importer/received_events","type":"User","site_admin":false},"labels":[{"id":1097433286,"node_id":"MDU6TGFiZWwxMDk3NDMzMjg2","url":"https://api.github.com/repos/tbeu/ModelicaSpecification/labels/bug","name":"bug","color":"d73a4a","default":true}],"state":"open","locked":false,"assignee":{"login":"tbeu","id":5444067,"node_id":"MDQ6VXNlcjU0NDQwNjc=","avatar_url":"https://avatars0.githubusercontent.com/u/5444067?v=4","gravatar_id":"","url":"https://api.github.com/users/tbeu","html_url":"https://github.com/tbeu","followers_url":"https://api.github.com/users/tbeu/followers","following_url":"https://api.github.com/users/tbeu/following{/other_user}","gists_url":"https://api.github.com/users/tbeu/gists{/gist_id}","starred_url":"https://api.github.com/users/tbeu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbeu/subscriptions","organizations_url":"https://api.github.com/users/tbeu/orgs","repos_url":"https://api.github.com/users/tbeu/repos","events_url":"https://api.github.com/users/tbeu/events{/privacy}","received_events_url":"https://api.github.com/users/tbeu/received_events","type":"User","site_admin":false},"assignees":[{"login":"tbeu","id":5444067,"node_id":"MDQ6VXNlcjU0NDQwNjc=","avatar_url":"https://avatars0.githubusercontent.com/u/5444067?v=4","gravatar_id":"","url":"https://api.github.com/users/tbeu","html_url":"https://github.com/tbeu","followers_url":"https://api.github.com/users/tbeu/followers","following_url":"https://api.github.com/users/tbeu/following{/other_user}","gists_url":"https://api.github.com/users/tbeu/gists{/gist_id}","starred_url":"https://api.github.com/users/tbeu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbeu/subscriptions","organizations_url":"https://api.github.com/users/tbeu/orgs","repos_url":"https://api.github.com/users/tbeu/repos","events_url":"https://api.github.com/users/tbeu/events{/privacy}","received_events_url":"https://api.github.com/users/tbeu/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2018-10-19T23:17:08Z","updated_at":"2018-10-19T23:18:39Z","closed_at":null,"author_association":"COLLABORATOR","body":"**Reported by choeger on 9 Jun 2010 11:19 UTC**\ncurrently a function Foo is considered being a subtype of function Bar if (among others) each input in Foo is a subtype of the corresponding input in Bar:\n\n```\npackage Test3\n        type Angle = Real(min=0.0, max=360.0);\n\n        function Foo\n                input Real a;\n                output Real b = a;\n        end Foo;\n\n        model A\n                replaceable function f = Foo;\n\n                Real x;\n                equation\n                x = f(4200);\n        end A;\n\n        function Bar\n                input Angle a;\n                output Angle b = a/2;\n        end Bar;\n\n        A a(redeclare function f = Bar);\nend Test3;\n```\n\nIn the above example Bar is a subtype of Foo but (obviously) cannot be used in the same context. The specification should be changed to reflect the fact, that (as usual in functional languages) the input types should be contravariant (i.e. the input of the subtype must be a supertype).\nIf anyone ever wants to do record as function parameters in Modelica this issue has to be resolved.\n\n\n\n----\n\nMigrated-From: https://trac.modelica.org/Modelica/ticket/379"},"comment":{"url":"https://api.github.com/repos/tbeu/ModelicaSpecification/issues/comments/431525229","html_url":"https://github.com/tbeu/ModelicaSpecification/issues/113#issuecomment-431525229","issue_url":"https://api.github.com/repos/tbeu/ModelicaSpecification/issues/113","id":431525229,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTUyNTIyOQ==","user":{"login":"modelica-trac-importer","id":22202507,"node_id":"MDQ6VXNlcjIyMjAyNTA3","avatar_url":"https://avatars1.githubusercontent.com/u/22202507?v=4","gravatar_id":"","url":"https://api.github.com/users/modelica-trac-importer","html_url":"https://github.com/modelica-trac-importer","followers_url":"https://api.github.com/users/modelica-trac-importer/followers","following_url":"https://api.github.com/users/modelica-trac-importer/following{/other_user}","gists_url":"https://api.github.com/users/modelica-trac-importer/gists{/gist_id}","starred_url":"https://api.github.com/users/modelica-trac-importer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modelica-trac-importer/subscriptions","organizations_url":"https://api.github.com/users/modelica-trac-importer/orgs","repos_url":"https://api.github.com/users/modelica-trac-importer/repos","events_url":"https://api.github.com/users/modelica-trac-importer/events{/privacy}","received_events_url":"https://api.github.com/users/modelica-trac-importer/received_events","type":"User","site_admin":false},"created_at":"2018-10-19T23:18:39Z","updated_at":"2018-10-19T23:18:39Z","author_association":"COLLABORATOR","body":"**Comment by choeger on 10 Jun 2010 13:04 UTC**\nReplying to [comment:6 HansOlsson]:\n> To correct a few misunderstandings:\n> \n> The Modelica subtype relation for functions is in fact different from other classes.\n\nThe Modelica specification tells us in 6.5 \n\nA function class A is function-compatible with or a function subtype of function class B iff, [The terms\nfunction-compatible and function subtype of are synonyms and used interchangeably]:\n * A is compatible to (subtype of) B.\n\nTherefore the subtype relation is a subset of the normal class subtype relation. This means covariance and is wrong. My second example should make this quite clear. The problem would be easy to solve if one would generally assume contravariance for `input` fields. But for now I am not quite sure if this would also work for input fields in normal classes (I doubt it). So in practice the `input` of function parameters should be distinct from any other input fields or the definition of function subtypes should not reference the \"normal\" subtype relation.\nFor more about function subtyping, see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.116.1298 \n\n> The specification for function calls are in section 12.4.\n> \n> Functions can have records (and operator record) expressions as inputs.\n\nThank you for the clarification on that topic."}}
{"actor":{"display_login":"modelica-trac-importer"}}