{"action":"created","issue":{"url":"https://api.github.com/repos/uqbar-project/wollok/issues/932","repository_url":"https://api.github.com/repos/uqbar-project/wollok","labels_url":"https://api.github.com/repos/uqbar-project/wollok/issues/932/labels{/name}","comments_url":"https://api.github.com/repos/uqbar-project/wollok/issues/932/comments","events_url":"https://api.github.com/repos/uqbar-project/wollok/issues/932/events","html_url":"https://github.com/uqbar-project/wollok/issues/932","id":171952932,"number":932,"title":"Throw an exception without \"new\" ","user":{"login":"lgassman","id":3935208,"avatar_url":"https://avatars.githubusercontent.com/u/3935208?v=3","gravatar_id":"","url":"https://api.github.com/users/lgassman","html_url":"https://github.com/lgassman","followers_url":"https://api.github.com/users/lgassman/followers","following_url":"https://api.github.com/users/lgassman/following{/other_user}","gists_url":"https://api.github.com/users/lgassman/gists{/gist_id}","starred_url":"https://api.github.com/users/lgassman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lgassman/subscriptions","organizations_url":"https://api.github.com/users/lgassman/orgs","repos_url":"https://api.github.com/users/lgassman/repos","events_url":"https://api.github.com/users/lgassman/events{/privacy}","received_events_url":"https://api.github.com/users/lgassman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/uqbar-project/wollok/labels/question%20/%20discussion","name":"question / discussion","color":"ededed"},{"url":"https://api.github.com/repos/uqbar-project/wollok/labels/type:%20Nice%20to%20Have","name":"type: Nice to Have","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-18T17:10:59Z","updated_at":"2016-08-18T18:14:21Z","closed_at":null,"body":"when an object is unable to fulfill its responsibility when it receives a message, it must throw an Exception/Error.  This is an independent concept of \"Class\". But the Exception/Error support  in wollok is using Classes: _throw new Exception(\"message error\")__  (I am ok?)\r\n\r\nI think that is nice to have a way to throw an Exception before to teach Classes. (Only the throw, no manage it)\r\n\r\nIn smalltalk I can use \"self error:\". but I dont like error: as an instance message of self. Alternatively you can think asError() as instance method of String. (Ex: \"messageError\".throwError()). It doesn't like me. Another option is an instance method of boolean Class (Ex: (a < b).assert(\"Problem because a >= b\"))\r\nI think is nice not use a message because you want to interrupt the message sending\r\n\r\nI think that a reserved word is necesary. Using \"error\" could have backwards compatibily problem, but is the best word. Using \"throw\" is less intuitive, but friend of Class style. \r\n\r\n```\r\nobject pepita {\r\n     var energy\r\n      method fly(kms) {\r\n             var usedEnergy = 10 - kms\r\n              if( energy < usedEnergy){\r\n                     error \"pepita has not energy to fly \" +  kms +\" kms\"\r\n              }\r\n              energy -= usedEnergy\r\n      }\r\n}\r\n\r\n\r\n\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/uqbar-project/wollok/issues/comments/240808943","html_url":"https://github.com/uqbar-project/wollok/issues/932#issuecomment-240808943","issue_url":"https://api.github.com/repos/uqbar-project/wollok/issues/932","id":240808943,"user":{"login":"flbulgarelli","id":677436,"avatar_url":"https://avatars.githubusercontent.com/u/677436?v=3","gravatar_id":"","url":"https://api.github.com/users/flbulgarelli","html_url":"https://github.com/flbulgarelli","followers_url":"https://api.github.com/users/flbulgarelli/followers","following_url":"https://api.github.com/users/flbulgarelli/following{/other_user}","gists_url":"https://api.github.com/users/flbulgarelli/gists{/gist_id}","starred_url":"https://api.github.com/users/flbulgarelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flbulgarelli/subscriptions","organizations_url":"https://api.github.com/users/flbulgarelli/orgs","repos_url":"https://api.github.com/users/flbulgarelli/repos","events_url":"https://api.github.com/users/flbulgarelli/events{/privacy}","received_events_url":"https://api.github.com/users/flbulgarelli/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T18:14:21Z","updated_at":"2016-08-18T18:14:21Z","body":"@PalumboN Nice, but isn't it a bit verbose?  It was because `throw` was already a reserved word, right?\r\n\r\nI thought it was going to be named `error.raise` or something like that. "}}
{"actor":{"display_login":"flbulgarelli"}}