{"action":"created","issue":{"url":"https://api.github.com/repos/tomhrr/dale/issues/107","repository_url":"https://api.github.com/repos/tomhrr/dale","labels_url":"https://api.github.com/repos/tomhrr/dale/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/tomhrr/dale/issues/107/comments","events_url":"https://api.github.com/repos/tomhrr/dale/issues/107/events","html_url":"https://github.com/tomhrr/dale/issues/107","id":177541642,"number":107,"title":"Extensibility of type concepts (i.e the already defined concepts)","user":{"login":"porky11","id":11576385,"avatar_url":"https://avatars.githubusercontent.com/u/11576385?v=3","gravatar_id":"","url":"https://api.github.com/users/porky11","html_url":"https://github.com/porky11","followers_url":"https://api.github.com/users/porky11/followers","following_url":"https://api.github.com/users/porky11/following{/other_user}","gists_url":"https://api.github.com/users/porky11/gists{/gist_id}","starred_url":"https://api.github.com/users/porky11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porky11/subscriptions","organizations_url":"https://api.github.com/users/porky11/orgs","repos_url":"https://api.github.com/users/porky11/repos","events_url":"https://api.github.com/users/porky11/events{/privacy}","received_events_url":"https://api.github.com/users/porky11/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-16T23:45:51Z","updated_at":"2016-09-27T10:24:15Z","closed_at":null,"body":"For example in your Array concept you check, if T implements some concept, and instantiates some other concept-macros automatically and such (https://github.com/tomhrr/dale/blob/master/modules/array.dt#L103)\r\n\r\nNow I define additional concepts (e.g. `Add`, which means, + is defined over the type), create a concept-macro + for arrays of these concepts, and want them to be implemented automatically, when the Array is instantiated.\r\n\r\nFor a single concept I could just define a new concept-macro which calls `(instantiate Array (force (uq T) Type))`, and then does the automatic instatiations, etc.. With multiple such concepts (eg. a `Sub` too, similar to `Add`), one would have to instantiate both with forcing them to the specific concept, which is not neccessary in your non-extensible way of implementing this.\r\nAnother problem, when doing so, is, that Type (refined by both concept macros) will be defined twice, which will report an error.\r\n\r\nThis can be avoided with some extra work (checking if the type exists, before defining it).\r\nSo when using this way of extending, some macro would be nice, which defines a type and doesn't report an error, when it already exists (should not be difficult). And all the struct definitions will have to be updated.\r\nThe same for the functions.\r\nAnother possibility would be enabeling to instantiate all concepts, that are implemented of the concept exactly once, or just recursively instantiating all the concepts, which are refined by a single concept (this should be more secure). Or doing even both (just instantiating once, and only the selected concept, via force, and it's refinements, if there are multiple implemented concepts).\r\nThis should also be implementable via macros, I think, but is more difficult.\r\nIt seems appropriate for concepts, which define a type and functions for it, but not for concepts which just define functions for a specific type.\r\n\r\nIf you have to instantiate a forced version to every specialized concept of the array, the first approach doesn't have much benefits anymore. The simplest solution with this seems a macro, which takes a list of concepts and instantiates the type for all of them.\r\nWith the second approach, this can also be done with a similar macro, by defining an anonymous (gensym) concept, which refines all the concepts in the list. and instantiating this without force. (but force may still be needed in the underlying macros)\r\n\r\nNow, that I have written this, I think, I may be able to implement something like this myself. Some suggestions which approach seems better, would be nice. If it works and is useful, I'll send a pull-request.\r\n"},"comment":{"url":"https://api.github.com/repos/tomhrr/dale/issues/comments/249826174","html_url":"https://github.com/tomhrr/dale/issues/107#issuecomment-249826174","issue_url":"https://api.github.com/repos/tomhrr/dale/issues/107","id":249826174,"user":{"login":"tomhrr","id":3089214,"avatar_url":"https://avatars.githubusercontent.com/u/3089214?v=3","gravatar_id":"","url":"https://api.github.com/users/tomhrr","html_url":"https://github.com/tomhrr","followers_url":"https://api.github.com/users/tomhrr/followers","following_url":"https://api.github.com/users/tomhrr/following{/other_user}","gists_url":"https://api.github.com/users/tomhrr/gists{/gist_id}","starred_url":"https://api.github.com/users/tomhrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomhrr/subscriptions","organizations_url":"https://api.github.com/users/tomhrr/orgs","repos_url":"https://api.github.com/users/tomhrr/repos","events_url":"https://api.github.com/users/tomhrr/events{/privacy}","received_events_url":"https://api.github.com/users/tomhrr/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T10:24:15Z","updated_at":"2016-09-27T10:24:15Z","body":"On Fri, Sep 16, 2016 at 04:45:52PM -0700, Fabio Krapohl wrote:\n> ...\n\nI think I'm missing something, here.  Wanting to be able to\ninstantiate the additional macros automatically makes sense, but\nputting that to one side, there shouldn't be a need in the above cases\nto use 'force'.  Nor should there be any problem with multiply-defined\ntypes.  The example program at\nhttps://github.com/tomhrr/dale/blob/master/eg/github-107/github-107.dt\nworks through the 'Add'/'Sub' use case, assuming I understand what\nyou're proposing.\n"}}
{"actor":{"display_login":"tomhrr"}}