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

conventions about function names #1335

Closed
ThomasBreuer opened this issue May 16, 2022 · 4 comments
Closed

conventions about function names #1335

ThomasBreuer opened this issue May 16, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@ThomasBreuer
Copy link
Member

It is helpful for Oscar users (in particular for beginners) if one can guess the names of functions one is interested in.
According to the general Julia conventions, capitalized names are "reserved for" modules and types, but Oscar provides quite a few functions with capitalized names.

  • A prominent example is PolynomialRing for the construction of a polynomial ring. A user would probably try polynomial_ring first, and there is a function with this name but without a docstring and with a different meaning.
  • Another example is CyclotomicField vs. cyclotomic_field; here we have docstrings for both variants.
  • For the function FiniteField, there is currently no finite_field variant.

There are more such examples.
Shall we collect them and then perform one big renaming in order to get a more consistent naming scheme, or shall we fix them one by one as soon as we are aware of them?

A related question is about those situations where users are expected to use types (with capitalized names).
For example, it is handy to call PermGroup(G) for some group G if one wants an isomorphic group that is represented by permutations (and if one wants to ignore the isomorphism object).
Or should we recommend to use a dedicated non-capitalized function for that purpose, in this case perm_group?
(It will not be possible or desirable to hide types from users. For example, it is useful to specify the result type of a function by passing this type as an argument, as in exponent(Int, symmetric_group(4)) or quo(PermGroup, G, N).)

@ThomasBreuer ThomasBreuer added the enhancement New feature or request label May 16, 2022
@fingolfin
Copy link
Member

I guess we can collect a few and then go through everything. If done right, this should not be a breaking change anyway. I don't think there is a point in trying to "do all at once", as on the one hand, that'll just delay improvements we could make now, and on the other hand, I see no real benefit?

For the permutation group, I think I see no real upside to having perm_group as an alias in the way Thomas describes -- but that's just me. If others think this is helpful... It might be useful to ask some newbie users, though? Or rather, ask them to participate in an experiment: "Your task is to take a finite FPGroup and convert it into an isomorphic permutation group. What would you try? What did or didn't work?"

@fingolfin
Copy link
Member

As to specifying the return type: I don't think there is any need or way to sugar coat this, and I consider it a substantially different problem from understanding the difference between PolynomialRing, polynomial_ring, quadratic_field, FiniteField, ... etc.

@thofma
Copy link
Collaborator

thofma commented May 17, 2022

I am not sure we should introduce aliases for the types, e.g., perm_group for PermGroup.

I would be in favour of having all functions adhere to the usual snake case convention.

@fingolfin fingolfin mentioned this issue Dec 14, 2022
29 tasks
@fingolfin
Copy link
Member

Merged into #1826

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants