Skip to content

Conversation

@burtonageo
Copy link
Contributor

Happy to bikeshed exactly what the docs should say

Copy link
Owner

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!
No major concerns, just a few questions.

src/matrix.rs Outdated
$( #[doc = $doc:expr] )*
$name:ident: $major_ty:ident $vec:ident[ $($field:ident = $index:expr),* ] = ($inner:expr, $outer:expr)
) => {
decl_matrix_type! {
Copy link
Owner

Choose a reason for hiding this comment

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

is there a point for a separate macro here if it's not used elsewhere?

Copy link
Contributor Author

@burtonageo burtonageo Apr 4, 2019

Choose a reason for hiding this comment

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

So, documentation generation for types declared in macros requires you to use the doc attribute, which is quite unwieldy.

The attribute itself can only take either a string literal, or a $expr fragment as its single argument, which means that:

  • you either have to construct the doc comment line by line using a sequence of #[doc = "blah"] #[doc = $string_expr] statements for interpolation, or:
  • you can do the interpolation using concat! and stringify!, and then pass that off to another macro (example taken from here), à la a c-style stringification macro.

I wish it were easier as well, but I think this is the simplest way I could find.

src/vector.rs Outdated
#[doc = "Constructs a `"]
#[doc = $sname]
#[doc = "` from the first "]
#[doc = $dim]
Copy link
Owner

Choose a reason for hiding this comment

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

wow that's quite strange. Is there a way to do string interpolation here?

src/vector.rs Outdated
$(#[doc = $doc:expr])*
$name:ident ($dim:expr) [ $($field:ident = $index:expr),* ] = $fixed:ty
) => {
decl_vector_type! {
Copy link
Owner

Choose a reason for hiding this comment

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

same question here - why do we need a separate macro?

@kvark
Copy link
Owner

kvark commented Apr 4, 2019

Can you please rebase on top of master instead of going with the merge commit?

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.

2 participants