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

Fate of name? #770

Open
maximlt opened this issue Jun 21, 2023 · 2 comments
Open

Fate of name? #770

maximlt opened this issue Jun 21, 2023 · 2 comments
Labels
type-bug Bug report
Milestone

Comments

@maximlt
Copy link
Member

maximlt commented Jun 21, 2023

This was certainly already suggested and discussed multiple times (e.g. #740 (comment) from @jlstevens) but I couldn't find a specific issue for it. name is a String Parameter included by default in every Parameterized object. At the class level it's set to the class name so P.name == P.__name__ and at the instance level it's set to the class name plus a global Parameterized instances count of 5 digits (e.g. P().name == "P00143").

The existence of name probably always comes as a surprise to Param users, I'm sure it had some very good reasons to exist when Param was created, however it seems to me this is no longer the case.

I'm sure .name is relied upon in many places in the HoloViz source codes (I definitively have code that uses P.name instead of P.__name__), removing it would certainly need to wait for Param 3.0. Until then, let's discuss how much we want to see it go away and if we do how it could be deprecated.

@maximlt maximlt added the type-bug Bug report label Jun 21, 2023
@maximlt maximlt added this to the Wishlist milestone Jun 21, 2023
@jbednar
Copy link
Member

jbednar commented Jun 21, 2023

I think it's more urgent to make .name behave normally than to remove it. Right now it behaves weirdly (#644), but I think we should be able to make it so that if someone overrides it with their own parameter it works as normal. Now that sentinel support is implemented I don't think it should even be difficult. Param itself shouldn't care about name per se, and then anything that builds on it and depends on the current behavior should work, but if people want name to be just a normal Parameter that should also work.

We could also separately support declaring that there shouldn't be a name parameter created at all, configurable at runtime, but that's more likely to have implications. We'd probably want to have .name still supply something in that case even if there is no name parameter that shows up in listings. Could be tricky, but probably better than fixing every instance of .name in all codebases.

@maximlt
Copy link
Member Author

maximlt commented Jun 21, 2023

I don't think it should even be difficult

Famous last words! :)

What you're asking for has been merged today after Philipp's review #740, not relying on sentinel support as name is treated way too specially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Bug report
Projects
None yet
Development

No branches or pull requests

2 participants