Skip to content

docs(class): add _create - #510

Open
cnjhb wants to merge 1 commit into
lunarmodules:masterfrom
cnjhb:master
Open

docs(class): add _create#510
cnjhb wants to merge 1 commit into
lunarmodules:masterfrom
cnjhb:master

Conversation

@cnjhb

@cnjhb cnjhb commented Jan 12, 2026

Copy link
Copy Markdown

I did not use ldoc to generate the documentation. The Lua link for the documentation I generated is 5.1 instead of the original 5.4.

@cnjhb cnjhb changed the title doc(class): add _create docs(class): add _create Jan 12, 2026

@alerque alerque left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes no sense to me. This is not how you typically create an instance of something using Penlight classes. This is for overriding the default instancer. This looks more like something you'd do in the :_init() function.

Additionally the example named you used is likely to be seen as provocative or demeaning. There is no sense at all in using same names that could be interpreted as inappropriate. It just distracts from the point of the docs.

What problem are you trying to fix here? What do you need to accomplish that the documentation doesn't cover for you?

@alerque
alerque marked this pull request as draft January 12, 2026 09:28
@cnjhb

cnjhb commented Jan 13, 2026

Copy link
Copy Markdown
Author

This makes no sense to me. This is not how you typically create an instance of something using Penlight classes. This is for overriding the default instancer. This looks more like something you'd do in the :_init() function.

Additionally the example named you used is likely to be seen as provocative or demeaning. There is no sense at all in using same names that could be interpreted as inappropriate. It just distracts from the point of the docs.

What problem are you trying to fix here? What do you need to accomplish that the documentation doesn't cover for you?

Sorry, my English isn't very good.
What I meant was to add _create to the documentation, because _create looks like it should be documented. Without looking at the implementation, no one would know that _create is available.

@alerque

alerque commented Jan 13, 2026

Copy link
Copy Markdown
Member

Without looking at the implementation, no one would know that _create is available.

This is true, but should they? Why do they need to know about it? What use case does it actually serve. It should almost never be used, it's meant to be a private function when you're doing something crazy like combining multiple class manager APIs. In those cases you probably should be looking at the implementation, not the docs.

The main issue in this PR is your example usage seems to be something that should be done via either a base class when you create define your class in the first place or via an :_init() function (both of which are documented). I'm open to having _create() documented, but we should at least give a proper explanation of when to use/not use it.

@cnjhb
cnjhb marked this pull request as ready for review January 14, 2026 01:47
@cnjhb
cnjhb requested a review from alerque January 14, 2026 01:47
@cnjhb

cnjhb commented Jan 14, 2026

Copy link
Copy Markdown
Author

Without looking at the implementation, no one would know that _create is available.

This is true, but should they? Why do they need to know about it? What use case does it actually serve. It should almost never be used, it's meant to be a private function when you're doing something crazy like combining multiple class manager APIs. In those cases you probably should be looking at the implementation, not the docs.

The main issue in this PR is your example usage seems to be something that should be done via either a base class when you create define your class in the first place or via an :_init() function (both of which are documented). I'm open to having _create() documented, but we should at least give a proper explanation of when to use/not use it.

I believe including it in the documentation also signifies that this API is reliable. Otherwise, even if users see the implementation and know this API exists, they'll worry whether it might be removed someday in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants