Quick actions

cmd+k|ctrl+k

Navigation

Languages

"a new kind of scope" = ordinary lexical scoping

Snippet info

Language

Raku

Visibility

unlisted

Author

raiph.mellor

Created

2021-10-12T19:17:26.747866Z

Updated

2021-12-14T15:34:06.456939Z

# # https://www.reddit.com/r/ProgrammingLanguages/comments/q6nlq4/a_new_kind_of_scope/hgebrip

    {
      my &processFile = { .say }     # `&` "sigil" for reference to function
      getFile 'asdf', &processFile;  # asdf -- Works because of callback
      processFile 'again';           # again -- Works because it's in scope
    }
 
    sub getFile(\name, &callback) {
      callback name;                 # (asdf)
#     processFile;                   # Compile-time error if uncommented
    }
INFO