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

Add method to GetClassID #275

Merged
merged 2 commits into from
Feb 20, 2024
Merged

Add method to GetClassID #275

merged 2 commits into from
Feb 20, 2024

Conversation

rockwotj
Copy link
Contributor

If you want to extend a built-in class you need it's class ID and there
is no robust way to get that without this accessor.

If you want to extend a built-in class you need it's class ID and there
is no robust way to get that without this accessor.

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
@saghul
Copy link
Contributor

saghul commented Feb 19, 2024

Isn't 0 a valid class ID?

@rockwotj
Copy link
Contributor Author

No class IDs start at 1 (well actually higher) AFAIK

@rockwotj
Copy link
Contributor Author

https://github.com/quickjs-ng/quickjs/blob/master/quickjs.c#L118

Class IDs explicitly start at 1

@rockwotj
Copy link
Contributor Author

If it helps, I am happy to define a constant for INVALID_CLASS_ID

Honestly this whole project could use a lot more documentation (I would be happy to add more comments to header for stuff if that's desirable)

@saghul
Copy link
Contributor

saghul commented Feb 19, 2024

If it helps, I am happy to define a constant for INVALID_CLASS_ID

I like this idea!

Honestly this whole project could use a lot more documentation (I would be happy to add more comments to header for stuff if that's desirable)

Yes indeed. I started working in it but I need to get back to it. The idea is to get some scaffolding going so we can then gradually add more.

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
@rockwotj
Copy link
Contributor Author

I like this idea!

Whoot! Done 😄

The idea is to get some scaffolding going so we can then gradually add more.

Are you talking about Doxygen? Honestly just comments in the header would be fine for me, but I understand other may prefer a web browser for docs.

@saghul
Copy link
Contributor

saghul commented Feb 20, 2024

I'm leaning towards Docusaurus indeed.

@saghul saghul merged commit 33f7249 into quickjs-ng:master Feb 20, 2024
35 checks passed
@chqrlie
Copy link
Collaborator

chqrlie commented Feb 21, 2024

I'm leaning towards Docusaurus indeed.

Looks good indeed from the comments and it would be nice to use quickjs instead of node to run it and construct the website, but given the number of module dependencies, this seems impossible :)
Also I could not find in the guides how to generate documentation directly from C or javascript source code ala doxygen.

@rockwotj
Copy link
Contributor Author

You would have to use doxygen to output XML then convert that into markdown or whatever format docusarus likes

@rockwotj
Copy link
Contributor Author

https://github.com/sourcey/moxygen looks like a interesting project

@saghul
Copy link
Contributor

saghul commented Feb 21, 2024

I'm leaning towards Docusaurus indeed.

Looks good indeed from the comments and it would be nice to use quickjs instead of node to run it and construct the website, but given the number of module dependencies, this seems impossible :)

Also I could not find in the guides how to generate documentation directly from C or javascript source code ala doxygen.

You need Node indeed.

The idea is not to auto-generate docs, but to write comprehensive documentation.

The header file could indeed have a concise version.

@rockwotj
Copy link
Contributor Author

The idea is not to auto-generate docs, but to write comprehensive documentation.

Not that I have really any weight in the matter, but I recommend checking out https://diataxis.fr/ if you're not familiar. There are 4 main use cases for technical documentation.

Tutorials, How tos, conceptual, and reference. I think conceptual isn't needed because there is plenty of good existing documentation on how javascript works conceptually. I think a tutorial and some how-tos on how to embed quickjs would be awesome (also personally what I've been trying to figure out). That's all great content for Docusaurus. There is a way to just do this all in Github, not that I'm advocating for that. For example, the examples today don't show how to embed quickjs - it'd be nice to have some simple tutorial/how to for that.

There is still a need for reference documentation, which for C is best (IMO) put in the header (you can also generate it, but I am not sure that's worth it). As I've needed and been learning about quickjs I'll send small patches for better documentation in quickjs.h - I hope that's OK. But certainly they all are useful.

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

Successfully merging this pull request may close these issues.

None yet

3 participants