{"action":"created","issue":{"url":"https://api.github.com/repos/latex3/latex3/issues/21","labels_url":"https://api.github.com/repos/latex3/latex3/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/latex3/latex3/issues/21/comments","events_url":"https://api.github.com/repos/latex3/latex3/issues/21/events","html_url":"https://github.com/latex3/latex3/issues/21","id":825995,"number":21,"title":"Escaping local definitions from groups","user":{"login":"blefloch","id":722786,"avatar_url":"https://avatars.githubusercontent.com/u/722786?v=3","gravatar_id":"","url":"https://api.github.com/users/blefloch","html_url":"https://github.com/blefloch","followers_url":"https://api.github.com/users/blefloch/followers","following_url":"https://api.github.com/users/blefloch/following{/other_user}","gists_url":"https://api.github.com/users/blefloch/gists{/gist_id}","starred_url":"https://api.github.com/users/blefloch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blefloch/subscriptions","organizations_url":"https://api.github.com/users/blefloch/orgs","repos_url":"https://api.github.com/users/blefloch/repos","events_url":"https://api.github.com/users/blefloch/events{/privacy}","received_events_url":"https://api.github.com/users/blefloch/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/latex3/latex3/labels/feature%20request","name":"feature request","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"wspr","id":8169,"avatar_url":"https://avatars.githubusercontent.com/u/8169?v=3","gravatar_id":"","url":"https://api.github.com/users/wspr","html_url":"https://github.com/wspr","followers_url":"https://api.github.com/users/wspr/followers","following_url":"https://api.github.com/users/wspr/following{/other_user}","gists_url":"https://api.github.com/users/wspr/gists{/gist_id}","starred_url":"https://api.github.com/users/wspr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wspr/subscriptions","organizations_url":"https://api.github.com/users/wspr/orgs","repos_url":"https://api.github.com/users/wspr/repos","events_url":"https://api.github.com/users/wspr/events{/privacy}","received_events_url":"https://api.github.com/users/wspr/received_events","type":"User","site_admin":false},"milestone":null,"comments":8,"created_at":"2011-04-28T19:26:39Z","updated_at":"2015-08-25T01:20:21Z","closed_at":null,"body":"Sometimes people need to define a token list (or whatever) locally within the group just outside the current group. To do that, a possibility (in want of better names) is\r\n\r\n    \\tl_new:N \\l_group_end_tl \r\n    \\cs_new_protected_nopar:Npn \\special_group_begin: \r\n        { \r\n             \\group_begin: \r\n             \\tl_set:Nn \\l_group_end_tl { \\group_end: } \r\n        }\r\n    \\cs_new_protected_nopar:Npn \\special_group_end: { \\l_group_end_tl } \r\n\r\n    \\cs_new_protected_nopar:Npn \\escape_tl_def:N #1 {\r\n          \\tl_put_right:Nx \\l_group_escape_tl { \\tl_set:Nn \\exp_not:N #1{ #1 } }\r\n    }\r\n    \\cs_new_eq:NN \\escape_clist_def:N \\escape_tl_def:N\r\n    \\cs_new_eq:NN \\escape_seq_def:N \\escape_tl_def:N\r\n    \\cs_new_eq:NN \\escape_prop_def:N \\escape_tl_def:N\r\n\r\n    \\cs_new_protected_nopar:Npn \\escape_int_def:N #1   {\r\n        \\tl_put_right:Nx \\l_group_escape_tl { \\int_set:Nn \\exp_not:N #1{ \\int_use:N #1 } }\r\n    }\r\n\r\nThis could be used in particular to open and close environments, since this is the most common situation from which users/programmers may want to escape their definition. The same could be done for groups closed with an implicit brace (e.g. boxes etc.), or `\\left...\\right` groups: it suffices to define `\\l_group_escape_tl` accordingly at the start of the environment."},"comment":{"url":"https://api.github.com/repos/latex3/latex3/issues/comments/134436558","html_url":"https://github.com/latex3/latex3/issues/21#issuecomment-134436558","issue_url":"https://api.github.com/repos/latex3/latex3/issues/21","id":134436558,"user":{"login":"wspr","id":8169,"avatar_url":"https://avatars.githubusercontent.com/u/8169?v=3","gravatar_id":"","url":"https://api.github.com/users/wspr","html_url":"https://github.com/wspr","followers_url":"https://api.github.com/users/wspr/followers","following_url":"https://api.github.com/users/wspr/following{/other_user}","gists_url":"https://api.github.com/users/wspr/gists{/gist_id}","starred_url":"https://api.github.com/users/wspr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wspr/subscriptions","organizations_url":"https://api.github.com/users/wspr/orgs","repos_url":"https://api.github.com/users/wspr/repos","events_url":"https://api.github.com/users/wspr/events{/privacy}","received_events_url":"https://api.github.com/users/wspr/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T01:20:21Z","updated_at":"2015-08-25T01:20:21Z","body":"> Perhaps having a function to save a value and one to retrieve it may be safer? \r\n\r\nIn that case why not just use a scratch global variable? Would there be a difference?\r\n\r\n> Concerning the matter of detecting automatically the copying function, that could be done without too much overhead\r\n\r\nThe more I think of it the more I prefer the idea of a function for each variable type — this avoids having to worry about problems like boxes/coffins."}}