Skip to content

Feature request: implicit addition instead of multiplication for sequential same type values #777

@commanderguy3001

Description

@commanderguy3001

often, I find myself wanting to specify sometime like time (hours plus minutes etc) or distance (feet and inches etc) with more than just one unit simultaneously.

currently, the behavior is "mathematically correct" (always use implicit addition when no specific operator is given).
this makes specifying a timeframe like "3 hours 2 minutes 5 seconds" quite annoying, as it results in 6480000 seconds^3, and you have to add brackets around it and explicit addition between them, which significantly reduces readability.
I would instead like to see numbat try and use a more common sense way of approaching this specific problem, by implicitly adding sequential values of the same type instead of doing implicit multiplication.

to further make this system smarter, one could limit implicit addition to only non-equal units ("1sec 1sec" would still make "sec^2"), and potentially even only series of units of increasing/decreasing order. ("1min 1sec" would be implicitly added, so would be "1sec 1min", but "1min 1sec 1hour" should throw some kind of "ambiguous implicit operation" error.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions