{"action":"created","issue":{"url":"https://api.github.com/repos/leafo/moonscript/issues/246","repository_url":"https://api.github.com/repos/leafo/moonscript","labels_url":"https://api.github.com/repos/leafo/moonscript/issues/246/labels{/name}","comments_url":"https://api.github.com/repos/leafo/moonscript/issues/246/comments","events_url":"https://api.github.com/repos/leafo/moonscript/issues/246/events","html_url":"https://github.com/leafo/moonscript/issues/246","id":138241081,"number":246,"title":"Inheriting from nil fails too late","user":{"login":"fendrin","id":1415983,"avatar_url":"https://avatars.githubusercontent.com/u/1415983?v=3","gravatar_id":"","url":"https://api.github.com/users/fendrin","html_url":"https://github.com/fendrin","followers_url":"https://api.github.com/users/fendrin/followers","following_url":"https://api.github.com/users/fendrin/following{/other_user}","gists_url":"https://api.github.com/users/fendrin/gists{/gist_id}","starred_url":"https://api.github.com/users/fendrin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fendrin/subscriptions","organizations_url":"https://api.github.com/users/fendrin/orgs","repos_url":"https://api.github.com/users/fendrin/repos","events_url":"https://api.github.com/users/fendrin/events{/privacy}","received_events_url":"https://api.github.com/users/fendrin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-03T17:16:10Z","updated_at":"2016-03-06T00:35:37Z","closed_at":null,"body":"```moonscript\r\nParent = nil \r\n\r\nclass Some extends Parent\r\n...\r\n```\r\n\r\nThis fails when the constructor of \"Some\" is called.\r\nThe error message \r\n\r\n> attempt to index local '_parent_0' (a nil value)\r\n\r\n isn't that helpful before you look into the implementation details of class.\r\n\r\nI suggest to let the code that defines the class check for nil parent and write a more useful error message.\r\n"},"comment":{"url":"https://api.github.com/repos/leafo/moonscript/issues/comments/192769061","html_url":"https://github.com/leafo/moonscript/issues/246#issuecomment-192769061","issue_url":"https://api.github.com/repos/leafo/moonscript/issues/246","id":192769061,"user":{"login":"Idyllei","id":8077451,"avatar_url":"https://avatars.githubusercontent.com/u/8077451?v=3","gravatar_id":"","url":"https://api.github.com/users/Idyllei","html_url":"https://github.com/Idyllei","followers_url":"https://api.github.com/users/Idyllei/followers","following_url":"https://api.github.com/users/Idyllei/following{/other_user}","gists_url":"https://api.github.com/users/Idyllei/gists{/gist_id}","starred_url":"https://api.github.com/users/Idyllei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Idyllei/subscriptions","organizations_url":"https://api.github.com/users/Idyllei/orgs","repos_url":"https://api.github.com/users/Idyllei/repos","events_url":"https://api.github.com/users/Idyllei/events{/privacy}","received_events_url":"https://api.github.com/users/Idyllei/received_events","type":"User","site_admin":false},"created_at":"2016-03-06T00:35:36Z","updated_at":"2016-03-06T00:35:36Z","body":":+1: After delving into some of Perl 6 code, I *very* strongly agree with @fendrin that this fails too late. I suggest that the translator fail as soon as possible once it encounters a case of inheriting from nil. (Perhaps, if the 'compiler' failing is not desirable, the Lua code that creates the constructor might error if it detects that it will inherit from nil *before* it can be called.)"}}