-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
consistent underscore naming policy #1539
Comments
I actually like having underscores everywhere, but also think that While we're on the topic of consistency in names, did we ever standardize on |
No, but I think we should. I'll make an issue for that. |
Oh, wait, we already have one: #907. |
I'm ambivalent on underscores; I have no great love or hate of them, I could go either way. For the question-mark syntax, since we need parens to call a function, are you suggesting the following:
|
Yeah, that's the idea. It would make |
I'd rather not, since we already allow the syntax |
I agree that Maybe there's an intermediate compromise where there's an accepted set of prefixes in the way that |
I like the idea of standard prefixes, so you can predict whether there is an underscore. The only wrinkle is that it's confounded by established names like |
I would like to register my support for allowing '?' as a constituent character of identifiers. Someone else suggested that we be obliged to separate any preceding name from the '?' in the ternary operator. Unlike the proposer, I'm not convinced that this is, in and of itself, a good thing to impose, but I do think it is a price worth paying for the ability to name predicates with a trailing '?'. |
Another fact that pushes me in favor of using trailing |
Since we're invoking intuitions from natural language, it's pretty clear that English predominantly makes questions by using tone at the end of sentences, which is what the Another perspective is that predicates derived from adjectives will work with |
I don't think it's necessary for every boolean function to be named consistently. |
why not camel. Functions begin with lowercase letters, types begin with upper case letters. isEmpty vs Matrix. Underscore can produce reeeeealy long names. I dont want to name my linear regression with automatic relenvance determination prior using empirical bayesian fitted by EM function as lin_reg_ard_eb_em() |
Exclamation mark ! when you are going to modify the data and ? for function asking things, looks too easy of understand and use. Even for Spanish speakers like me. In Spanish. ( And I like the idea of something consistent, but can be awkward introduce some extra rule for ternary operator ) In Spanish, we grammatically use two sings, one for open ( ¿ ¡ ) and one for close ( ! ? ). But English it's so popular and using a trailing sign is more faster and comfortable, we use to use the English notation in the colloquial writing now. Using ¿ ¡ symbols in beginning it's not going to collide with nothing... But can be awkward to native English speakers?
The last looks to good to my, because I'm a Spanish speaker. But I'm comfortable whit the two first. P.S.: I'm think that dequeue functions need to be consistent with the ! rules |
As you said, opening ¿ ¡ are clearly on their way out of the layperson's Spanish language. So I don't think adding them would help Julia. I do agree that we should strive for greater consistency in naming functions that modify their inputs. I would like to add ?, but that interferes with the ternary operator. -- John On Jan 6, 2013, at 5:23 PM, diegozea [email protected] wrote:
|
Trailing ? can be dealt with pretty easily – an identifier immediately followed by ? can just be parsed as an identifier. Putting the ? in the ternary operator right after an identifier is kind of a readability snafu anyway (although we do it a few times in base, that can easily be fixed); technically, it would be a breaking change, however. |
Do we have an issue open for ? at the end of function names? |
I don't believe we do. We should add one. |
what was the decision on this? i recall that we would continue being inconsistent, preferring underscores for most names, but dropping them for short, common names like isempty and established names like getenv. if so, this issue can presumably be closed. |
General thinking, discussed with Jeff the other day is that names without spaces are in some sense "atomic" or "indivisible" – they are the words from which sentences are formed. Functions with spaces (i.e. underscores) are conceptually sentences, e.g. |
To that end, we have been endeavoring to eradicate underscores from base, either by breaking them down into more basic pieces or by not exporting them at all. |
How about e.g. |
This doesn't have to be set in stone, but I've been finding that looking for underscores is an awfully good way to find the smellier parts of base. |
I think we've done a fair enough job of this for 0.1 so I'm retagging this as 0.2. |
As there aren't much Boolean function in Julia, I think it's a good idea to make question mark as a prefix. This would benefit people who needs The parser should consider |
Another idea: |
…le_hint->precompile un-export enq_work rename each_line in doc rename usleep to systemsleep (not exported)
How about renaming |
remove parse_bin, parse_oct, parse_hex ref #1539
Go ahead. Any underscore removal is usually good. |
I think the "policy" is resolved and now this is just normal renaming over time. |
This is probably way too late, but I'm new to Julia: https://groups.google.com/forum/#!topic/julia-users/IvdFNaaV1qA |
…34091) git log --oneline 0c2dddd40e4d7492d2a7337be54c345011e5f1e1^..8e236a7f993f1e732ffd0ab5c15736b2594e4109 8e236a7 (HEAD -> master, origin/master, origin/HEAD) Merge pull request #1544 from JuliaLang/sk/telemetry 90b8482 telemetry: factor out telemetry file loading 228fb97 CI telemetry: send indicators for common CI env vars 246dbd0 Pkg protocol: basic anonymous opt-out telemetry e66a75f Introduce special REPL syntax for shared environments (#1488) afeb1ee Merge pull request #1538 from JuliaLang/sk/pkg-client-auth 9c357bb Pkg client auth: support connecting to authenticated Pkg servers 6dd7f34 PlatformEngines: revert API part of headers support (broken) 6825b48 Merge pull request #1539 from 00vareladavid/00/fixes 3f1cf40 it is invalid to `add` a package with no commits 0766765 test: default environment should be created when the primary depot does not exist 43f46f8 check no overwrite is occuring when resolving from a project file 37b6853 handle primary depot as relative path 53fdf24 Check for duplicate name/UUID input 8a6387c Remove redundant precompile statement 4d0901e Dont throw error when autocompleting faulty input (#1530) d69f6d7 Refactor and test `Pkg.test` (#1427) 8ca8b6d PlatformEngines: use `tar -m` to ignore mtimes (#1537) 6797928 Make sure sandbox's temp Project.toml and Manifest.toml files are writable (#1534) f968cc9 clarify: stacked envs only affect top-level loading (#1529) 0dfef59 PlatformEngines.download: add header support (#1531) 49ab53e Fix tree hashing with nested empty directories (#1522) 0c2dddd fix #1514: install_archive call in backwards_compatible_isolation (#1517)
…34091) git log --oneline 0c2dddd40e4d7492d2a7337be54c345011e5f1e1^..8e236a7f993f1e732ffd0ab5c15736b2594e4109 8e236a7 (HEAD -> master, origin/master, origin/HEAD) Merge pull request #1544 from JuliaLang/sk/telemetry 90b8482 telemetry: factor out telemetry file loading 228fb97 CI telemetry: send indicators for common CI env vars 246dbd0 Pkg protocol: basic anonymous opt-out telemetry e66a75f Introduce special REPL syntax for shared environments (#1488) afeb1ee Merge pull request #1538 from JuliaLang/sk/pkg-client-auth 9c357bb Pkg client auth: support connecting to authenticated Pkg servers 6dd7f34 PlatformEngines: revert API part of headers support (broken) 6825b48 Merge pull request #1539 from 00vareladavid/00/fixes 3f1cf40 it is invalid to `add` a package with no commits 0766765 test: default environment should be created when the primary depot does not exist 43f46f8 check no overwrite is occuring when resolving from a project file 37b6853 handle primary depot as relative path 53fdf24 Check for duplicate name/UUID input 8a6387c Remove redundant precompile statement 4d0901e Dont throw error when autocompleting faulty input (#1530) d69f6d7 Refactor and test `Pkg.test` (#1427) 8ca8b6d PlatformEngines: use `tar -m` to ignore mtimes (#1537) 6797928 Make sure sandbox's temp Project.toml and Manifest.toml files are writable (#1534) f968cc9 clarify: stacked envs only affect top-level loading (#1529) 0dfef59 PlatformEngines.download: add header support (#1531) 49ab53e Fix tree hashing with nested empty directories (#1522) 0c2dddd fix #1514: install_archive call in backwards_compatible_isolation (#1517)
This is kind of a blanket issue that intersects with API cleanup and naming consistency, but we need to figure our shit out regarding when to underscore and when not to underscore. One possibly controversial proposal (that I'm not really sure I favor), would be using underscores consistently, which turns especially predicates like
isempty
into the much more annoyingis_empty
, but which would be addressed by adding support for names that end in?
and writingempty?
instead. Another proposal would be that names in base, as the basic "grammar" of Julia don't use underscores whereas things in packages and user code use underscores. Or we just go fully Germanic and don't use underscores ever. Or we can just keep on being completely inconsistent.The text was updated successfully, but these errors were encountered: