Skip to content

Spec clarification: resolving the type when chaining local variables #292

@mihnita

Description

@mihnita

Here is an example:

let $foo = {$count :number currency=$cur precision=2 rounding=up}
let $pers = {$foo :person level=formal}
let $bar = {$pers :date skeleton=yMMMdE}
match {$bar} ...

This would take $count, formats it as currency, then we try to format as person, then as date, and them make a decision on it.

Is there a good use case to do such chaining?
Or we are only struggling to support something that is useless, and potentially dangerous?

A more reasonable restriction would be that the "chained" variables use the same function:

let $fullDate = {$exp :date year=numeric month=full day=numeric}
let $shortDate = {$fullDate :date month=numeric}

In this case the reasonable behavior would be to merge the two maps of options and format with :date.
Although even that is a bit problematic: what if I want to remove a field from the first variable?

Are we making things complicated for little benefit? (saving a copy paste once in a blue moon)

It is a bit like C macros.
One level you can put up with.
Go macros defined on top of macros, and things get messier and messier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocker-candidateThe submitter thinks this might be a block for the next releaseresolve-candidateThis issue appears to have been answered or resolved, and may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions