Skip to content

Ability to parametrise arguments #268

Open
@juliancoffee

Description

@juliancoffee

Blocked on projectfluent/fluent#80


As far as I know in Fluent we can't parametrise arguments. In a sense that this code will be impossible to parse.

skeleton = {$case ->
  [genitive] Skeleton
  [possessive] by Skeleton
}
cultist = {$case ->
  [genitive] Cultist
  [possessive] by Cultist
}
shoot = { $victim } has be shoot { $attacker(case: "possessive") }

This is obviously not a problem for English, but it is a problem for other languages with grammatical cases, for example, Slavic ones.
(I translated the bear was killed by another bear to Polish and got niedźwiedź został również zabity przez innego niedźwiedzia. You can see the difference between niedźwiedź and niedźwiedzia)

So to solve it, I was thinking about adding EVAL function, which would take its first parameter as a term and pass args to it.
shoot = { $victim } has been shoot { EVAL($attacker, case: "possessive") }

Doing it externally would require allocating the bundle on the heap so we can capture its address in closure. But the reference to the bundle is always here when we call function, as all functions are stored in the bundle, so this may be some built-in.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions