fluent icon indicating copy to clipboard operation
fluent copied to clipboard

Term references with positional arguments?

Open SirNickolas opened this issue 6 years ago • 1 comments

-term = Term
    .attr = Attr

msg = {-term(0)}, {-term.attr(1)}.

When parameterized terms were introduced, @stasm wrote:

When calling a term, both positional and named arguments can be used, but positional are ignored, because, by their anonymous nature, they can't be looked up via variable names.

Shouldn’t a warning be emitted in such case?

By the way, how is it supposed to work, in the first place? Because that’s the point where official implementations diverge: JS and Rust silently ignore positionals while Python emits a warning and doesn’t even resolve positional arguments:

# "Invalid argument to NUMBER" in JS and Rust, "Ignored positional arguments" in Python.
test-0 = {-term(NUMBER("x"))}

# Called in JS and Rust, isn't in Python.
test-1 = {-term(FUNC-WITH-SIDE-EFFECTS())}

SirNickolas avatar Sep 17 '19 13:09 SirNickolas

Resolver behavior is unspecified, so different behavior between implementations is expected for now.

I just filed #294 to propose restrictions on what functions are expected to do.

Note, for our environment, we have a bug on file to warn about "silly terms" within the l10n toolchain, https://bugzilla.mozilla.org/show_bug.cgi?id=1529589.

I think it's much more impactful to do so in the l10n toolchain than in runtime behavior.

Pike avatar Sep 17 '19 14:09 Pike