{"action":"created","issue":{"url":"https://api.github.com/repos/renpy/renpy/issues/916","repository_url":"https://api.github.com/repos/renpy/renpy","labels_url":"https://api.github.com/repos/renpy/renpy/issues/916/labels{/name}","comments_url":"https://api.github.com/repos/renpy/renpy/issues/916/comments","events_url":"https://api.github.com/repos/renpy/renpy/issues/916/events","html_url":"https://github.com/renpy/renpy/pull/916","id":149460956,"number":916,"title":"add local/nested labels support","user":{"login":"caryoscelus","id":1758893,"avatar_url":"https://avatars.githubusercontent.com/u/1758893?v=3","gravatar_id":"","url":"https://api.github.com/users/caryoscelus","html_url":"https://github.com/caryoscelus","followers_url":"https://api.github.com/users/caryoscelus/followers","following_url":"https://api.github.com/users/caryoscelus/following{/other_user}","gists_url":"https://api.github.com/users/caryoscelus/gists{/gist_id}","starred_url":"https://api.github.com/users/caryoscelus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caryoscelus/subscriptions","organizations_url":"https://api.github.com/users/caryoscelus/orgs","repos_url":"https://api.github.com/users/caryoscelus/repos","events_url":"https://api.github.com/users/caryoscelus/events{/privacy}","received_events_url":"https://api.github.com/users/caryoscelus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-19T13:25:59Z","updated_at":"2016-04-20T13:01:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/renpy/renpy/pulls/916","html_url":"https://github.com/renpy/renpy/pull/916","diff_url":"https://github.com/renpy/renpy/pull/916.diff","patch_url":"https://github.com/renpy/renpy/pull/916.patch"},"body":"Originally proposed here: https://lemmasoft.renai.us/forums/viewtopic.php?f=32&t=38122\r\n\r\n> When the script is heavy-choice, amount of labels can soon get unmanageable. I think the usual way to avoid name collisions is to use something like \"chapter1_episode1_choice1\", but it is ugly, verbose and still doesn't guarantee avoidance of collisions, especially when using third-party code.\r\n> \r\n> To resolve this problem i propose introducing 'local' labels, which can have identical names inside different 'global' labels. Here's how it works:\r\n> \r\n> ```renpy\r\n> label global_label:             # normal label, nothing changed for its behaviour\r\n>   \"...\"\r\n> label .a:                       # local label fully identified as global_label.a\r\n>   \"...\"\r\n>   jump .a                       # local jump, resolved to global_label.a\r\n> \r\n> label another_global_label:\r\n>   \"...\"\r\n> label .a:                       # another_global_label.a\r\n>   jump global_label.a\r\n> ```\r\n> \r\n> Syntax-wise, it's fully backwards compatible since currently label names cannot contain dot and thus all existing labels are considered global with this change.\r\n> \r\n> It is also possible to expand this idea to have no nesting limit (i.e. making possible to have label a.b.c.d and jump to it inside a.b.c scope by simply \"jump ...d\")\r\n> \r\n> I also found out that it is currently possible to 'nest' labels using indentation, but it doesn't protect from name collisions. It is possible to implement the same mechanism with such nested labels, but since it uses old syntax, it can cause problems with existing code. Also, it is more visual which can sometimes be good, but can also be bad when you prefer all statements to be on same indentation level.\r\n\r\nWhile waiting for comments, i finished implementing it anyway and so making this pr for more specific discussion. If this is going to be accepted, i'll mention this in docs as well."},"comment":{"url":"https://api.github.com/repos/renpy/renpy/issues/comments/212414282","html_url":"https://github.com/renpy/renpy/pull/916#issuecomment-212414282","issue_url":"https://api.github.com/repos/renpy/renpy/issues/916","id":212414282,"user":{"login":"renpytom","id":379804,"avatar_url":"https://avatars.githubusercontent.com/u/379804?v=3","gravatar_id":"","url":"https://api.github.com/users/renpytom","html_url":"https://github.com/renpytom","followers_url":"https://api.github.com/users/renpytom/followers","following_url":"https://api.github.com/users/renpytom/following{/other_user}","gists_url":"https://api.github.com/users/renpytom/gists{/gist_id}","starred_url":"https://api.github.com/users/renpytom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renpytom/subscriptions","organizations_url":"https://api.github.com/users/renpytom/orgs","repos_url":"https://api.github.com/users/renpytom/repos","events_url":"https://api.github.com/users/renpytom/events{/privacy}","received_events_url":"https://api.github.com/users/renpytom/received_events","type":"User","site_admin":false},"created_at":"2016-04-20T13:01:59Z","updated_at":"2016-04-20T13:01:59Z","body":"I think one level is fine, and anything more would be excessive.\r\n\r\n"}}