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

Use a macro in lang_items to remove duplication. #10832

Conversation

chris-morgan
Copy link
Member

This should make maintenance of lang items simpler and also reduces the
line count by about 201 lines.

This should make maintenance of lang items simpler and also reduces the
line count by about 201 lines.
lets_do_this! {
There are 41 lang items.

// ID, Variant name, Name, Method name;
Copy link
Member

Choose a reason for hiding this comment

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

This header could be part of the macro definition, not just a comment.

There are 41 lang items. The lang items follow:

ID, Variant name, Name, Method name;
// ...

:P

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure; we can go for a full-blown literate coding style if we want, too!

(I'll leave that to your imagination.)

@chris-morgan
Copy link
Member Author

@alexcrichton not needing to keep track of the numbers at all would be handy; to do that, we'd need a (a) a counter syntax extension (something like the CSS counters module) which can be used inside a repeat, and (b) some way of counting repeats in macros (to get the number 41). Those are certainly out of scope for this particular thing.

bors added a commit that referenced this pull request Dec 6, 2013
…nt, r=alexcrichton

This should make maintenance of lang items simpler and also reduces the
line count by about 201 lines.
@bors bors closed this Dec 6, 2013
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.

4 participants