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

WASM Automatic Demo Generator Proof of Concept #500

Open
wants to merge 374 commits into
base: main
Choose a base branch
from

Conversation

ambiguousname
Copy link
Contributor

@ambiguousname
Copy link
Contributor Author

Mixed syntax for arguments, terminusArgs, and ...args. Cleaning up would be helpful, so using the argument names would be better than terminusArgs[3], say.

@ambiguousname
Copy link
Contributor Author

ambiguousname commented Jul 16, 2024

Move rendering.mjs into templates, call it diplomatDefaultRendering.mjs (maybe with the base .html and index.js file too, if index.html is not detected?) and copy it over every time it's run.

Comment on lines +7 to +11
null,
[
terminusArgs[0]
]
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Indentation?

Comment on lines +24 to +32
(function (...args) {
let out = new ICU4XFixedDecimalFormatterOptions();

out.groupingStrategy = args[0];

out.someOtherConfig = args[1];

return out;
}).apply(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: mixed tabs and spaces

Comment on lines +24 to +38
(function (...args) {
let out = new ICU4XFixedDecimalFormatterOptions();

out.groupingStrategy = args[0];

out.someOtherConfig = args[1];

return out;
}).apply(
null,
[
terminusArgs[1],
terminusArgs[2]
]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion, if easy:

Suggested change
(function (...args) {
let out = new ICU4XFixedDecimalFormatterOptions();
out.groupingStrategy = args[0];
out.someOtherConfig = args[1];
return out;
}).apply(
null,
[
terminusArgs[1],
terminusArgs[2]
]
)
(function () {
let out = new ICU4XFixedDecimalFormatterOptions();
out.groupingStrategy = terminusArgs[1];
out.someOtherConfig = terminusArgs[2];
return out;
})()

ICU4XFixedDecimal.new_.apply(
null,
[
terminusArgs[3]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: If you have enough information to know that "it is the third argument", you probably also know the variable name.

Some(label)
}
})
.unwrap_or(param_name.clone());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: param_name.clone() could instead use heck to produce a nicer titlecase label

@@ -10,6 +10,7 @@ pub mod ffi {
impl ICU4XLocale {
/// Construct an [`ICU4XLocale`] from a locale identifier represented as a string.
#[diplomat::attr(supports = constructors, constructor)]
#[diplomat::demo(input(name(label = "Locale Name")))]
pub fn new(name: &DiplomatStr) -> Box<ICU4XLocale> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: name could be changed to locale_name. This improvement could be applied elsewhere, too.

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

2 participants