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

Demo_Gen: Better Organized Output #609

Open
Tracked by #604
ambiguousname opened this issue Jul 30, 2024 · 2 comments
Open
Tracked by #604

Demo_Gen: Better Organized Output #609

ambiguousname opened this issue Jul 30, 2024 · 2 comments
Labels
B-demo_gen Demo_Gen backend

Comments

@ambiguousname
Copy link
Member

Something cleaner than

import { DataProvider } from "./js/DataProvider.mjs"
import { FixedDecimal } from "./js/FixedDecimal.mjs"
import { FixedDecimalFormatter } from "./js/FixedDecimalFormatter.mjs"
import { FixedDecimalFormatterOptions } from "./js/FixedDecimalFormatterOptions.mjs"
import { Locale } from "./js/Locale.mjs"
export function formatWrite() {
    var terminusArgs = arguments;
    return (function (...args) { return args[0].formatWrite(...args.slice(1)) }).apply(
        null,
        [
            FixedDecimalFormatter.tryNew.apply(
                null,
                [
                    Locale.new_.apply(
                        null,
                        [
                            terminusArgs[0]
                        ]
                    ),
                    DataProvider.newStatic.apply(
                        null,
                        [
                        ]
                    ),
                    (function (...args) {
                        let out = new FixedDecimalFormatterOptions();
                        
                        out.groupingStrategy = args[0];
                        
                        out.someOtherConfig = args[1];
                        
                        return out;
                    }).apply(
                        null,
                        [
                            terminusArgs[1],
                            terminusArgs[2]
                        ]
                    )
                ]
            ),
            FixedDecimal.new_.apply(
                null,
                [
                    terminusArgs[3]
                ]
            )
        ]
    );
}

Would be nice.

@Manishearth I know this confusing for you, if you have any thoughts about organization, let me know!

@ambiguousname
Copy link
Member Author

#500 (comment) is also part of this

@Manishearth
Copy link
Contributor

I think it's fine. Would be nice if the code were linear instead of nested, with let locale = blah, etc, naming the intermediates by the same scheme we use to name the terminus args.

Which, speaking of, ideally those are named too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-demo_gen Demo_Gen backend
Projects
None yet
Development

No branches or pull requests

2 participants