Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO: Remove ALL names that begin with an underscore #43

Closed
DilumAluthge opened this issue Jun 7, 2019 · 0 comments
Closed

TODO: Remove ALL names that begin with an underscore #43

DilumAluthge opened this issue Jun 7, 2019 · 0 comments

Comments

@DilumAluthge
Copy link
Member

I am going to implement a new convention in which all functions that rely on trait-dispatch will have a name that begins with _. This property will be bijective:

  • If a function relies on trait-dispatch, it will have a name that begin with _
  • If a name begins with _, it will be the name of a function that relies on trait-dispatch

Before I can implement this convention, I will need to remove ALL names that begin with an underscore by renaming them to names that do not begin with underscores. By "names", I not only mean functions but also types, global variables, etc.

Once I have removed all names that begin with an underscore, I will close this issue. Then, I can begin adding functions that rely on trait-dispatch.

There will be only ONE exception to this rule: __init__() functions. These functions are required by Julia to be named __init__(), so I will have to keep that name. There will be no other exceptions.


Here are some code snippets that I can run in the REPL in order to find any names that begin with an underscore:

for x in names(Main; all=true, imported=true)
    if startswith(strip(string(x)), "_")
        println(x)
    end
end
for x in names(Main.MyExampleModule; all=true, imported=true)
    if startswith(strip(string(x)), "_")
        println(x)
    end
end
for x in names(MyExampleModule; all=true, imported=true)
    if startswith(strip(string(x)), "_")
        println(x)
    end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant