- Notifications
You must be signed in to change notification settings - Fork0
Scope is a small module that provides two macros to facilitate function overload and local import/aliases execution.
License
NotificationsYou must be signed in to change notification settings
xvw/scope
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Scope is a small module that provides two macros to facilitatefunction overload and local import/aliases execution.
importScopeoverload[+:2,-:2],from:Kernel,with:Test1+3-2# gives [2, [1, 3]]
You can just import one or more module :
importScopex=localSystemdouser_home<>" !"end# Or multiple moduley=localElixir.{System,Path}doabsname(user_home())end# Or specifics function from a modulez=local[user_home:0,user_home!:0]inSystemdouser_home<>" !"end
You can also directly use an expression:
importScopea=local(overload[+:2,-:2],from:Kernel,with:Test)do1+2-3endb=1+2-3# a == [3, [1, 2]]# b == 0c=local(importTest)doa=1+2b=1-2a-bend
Ifavailable in Hex, the package can be installedby addingscope
to your list of dependencies inmix.exs
:
defdepsdo[{:scope,"~> 1.0.0"}]end
Documentation can be generated withExDocand published onHexDocs. Once published, the docs canbe found athttps://hexdocs.pm/local.