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

Term's attributes can't be used as variable values #338

Open
caridy opened this issue Nov 5, 2021 · 2 comments
Open

Term's attributes can't be used as variable values #338

caridy opened this issue Nov 5, 2021 · 2 comments

Comments

@caridy
Copy link

caridy commented Nov 5, 2021

I can think of two important use-cases for this, but I'm afraid I'm missing some important about the design principles behind fluent, but first, let's see the example from the documentation:

-brand-name = Aurora
    .gender = feminine

update-successful =
    { -brand-name.gender ->
        [masculine] { -brand-name} został zaktualizowany.
        [feminine] { -brand-name } została zaktualizowana.
       *[other] Program { -brand-name } został zaktualizowany.
    }

In this example, -brand-name.gender is used as a selector, and it works just fine. This feature allows developers to keep the information about the brand name in a single place, and reuse it the value in various places.

Lets now see another example:

-brand-name = Aurora
    .gender = feminine

-foo = { $gender -> 
    [feminine] some
    *[masculine] another
}

x = { -foo(gender: "feminine") }
y = { -foo(gender: -brand-name.gender) }

In this case, y message throws during parsing with E0014: Expected literal, which I suspect is related to #337. This prevents reusing the attribute of a term as the value of a variable.

cc @gonzalocordero

@zbraniecki
Copy link
Collaborator

@stasm @eemeli

@eemeli
Copy link
Member

eemeli commented Nov 5, 2021

This seems to be a special case of the same change as proposed in #230, yes?

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

No branches or pull requests

3 participants