{"action":"created","issue":{"url":"https://api.github.com/repos/mikeric/rivets/issues/591","repository_url":"https://api.github.com/repos/mikeric/rivets","labels_url":"https://api.github.com/repos/mikeric/rivets/issues/591/labels{/name}","comments_url":"https://api.github.com/repos/mikeric/rivets/issues/591/comments","events_url":"https://api.github.com/repos/mikeric/rivets/issues/591/events","html_url":"https://github.com/mikeric/rivets/issues/591","id":134095999,"number":591,"title":"Possibility to extend rivets expression syntax","user":{"login":"stalniy","id":1159966,"avatar_url":"https://avatars.githubusercontent.com/u/1159966?v=3","gravatar_id":"","url":"https://api.github.com/users/stalniy","html_url":"https://github.com/stalniy","followers_url":"https://api.github.com/users/stalniy/followers","following_url":"https://api.github.com/users/stalniy/following{/other_user}","gists_url":"https://api.github.com/users/stalniy/gists{/gist_id}","starred_url":"https://api.github.com/users/stalniy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stalniy/subscriptions","organizations_url":"https://api.github.com/users/stalniy/orgs","repos_url":"https://api.github.com/users/stalniy/repos","events_url":"https://api.github.com/users/stalniy/events{/privacy}","received_events_url":"https://api.github.com/users/stalniy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-16T21:02:49Z","updated_at":"2016-02-16T22:33:33Z","closed_at":null,"body":"Currently only keypath expressions and primitives can be passed as parameters to both components' attributes and binders value. I suggest to allow users to extend this functionality. So, I for example want to pass an object to binder:\r\n```html\r\n<div rv-popover=\"enabled: user.isActive, template: customTemplate\">{ user.name }</div>\r\n```\r\n\r\n**Proposal**:\r\n* expose rivets parser as configuration option. So, default value will be a pointer to `Rivets.TypeParser`. \r\n* implement method `addExpressionSupport` which accepts an object with `parse` method. Adds expression parser to top of the expression parsers stack\r\n* then call `parse` method for each expression object. If something is returned then stop iteration. We know how to parse this string\r\n* the returning result of the `parse` method will be and object which has `keypaths` property (our observable dependencies) and `evaluate` method calling which the result of the expression can be retrieved\r\n\r\nThat will allow devs to extend existing expressions with own a bit more advanced as I showed in popover example or even substitute parser with its own (or custom) implementation.\r\n\r\n```js\r\nrivets.configure({ parser: new MyCustomParser() });\r\n\r\n// or \r\nrivets.parser.addExpressionSupport(new ObjectExpressionParser());\r\n```"},"comment":{"url":"https://api.github.com/repos/mikeric/rivets/issues/comments/184901978","html_url":"https://github.com/mikeric/rivets/issues/591#issuecomment-184901978","issue_url":"https://api.github.com/repos/mikeric/rivets/issues/591","id":184901978,"user":{"login":"stalniy","id":1159966,"avatar_url":"https://avatars.githubusercontent.com/u/1159966?v=3","gravatar_id":"","url":"https://api.github.com/users/stalniy","html_url":"https://github.com/stalniy","followers_url":"https://api.github.com/users/stalniy/followers","following_url":"https://api.github.com/users/stalniy/following{/other_user}","gists_url":"https://api.github.com/users/stalniy/gists{/gist_id}","starred_url":"https://api.github.com/users/stalniy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stalniy/subscriptions","organizations_url":"https://api.github.com/users/stalniy/orgs","repos_url":"https://api.github.com/users/stalniy/repos","events_url":"https://api.github.com/users/stalniy/events{/privacy}","received_events_url":"https://api.github.com/users/stalniy/received_events","type":"User","site_admin":false},"created_at":"2016-02-16T22:33:33Z","updated_at":"2016-02-16T22:33:33Z","body":"@jccazeaux \r\n\r\nyes, it's possible. So, look at the definition `rv-popover=\"enabled: user.isActive, template: myTemplate\"`. We want to subscribe to values of the object declaration and compute a new object each time any of its values are changed. And values are basically keypaths or primitives which rivets are able to parse"}}