Skip to content

PushHide and PopHide together with regular Hide statement #828

@cbmarini

Description

@cbmarini

What should the intended behaviour of the following program be?

Symbols x;
Local F1 = x+1;
.sort

PushHide;
Local F2 = x+2;
.sort

PushHide;
Local F3 = x+3;
.sort

Hide;
.sort

PopHide;
Print;
.end

At the moment, this results in

   F1 =
      1 + x;

   F2 =
      2 + x;

   F3 =
      3 + x;

so all three expressions become active again.

The manual states the following about PopHide:

Undoes the action of the most recent pushhide statement (see 7.121). If there is no matching pushhide statement an error will result.

Based on this description, I would expect the final PopHide; to reactivate only F2.

Internally, the push/pop mechanism is implemented through the hidelevel assigned to each expression. However, the Hide; statement resets the hidelevel of all hidden expressions so far to the highest current level. As a result, all hidden expressions are reactivated by the first PopHide;.
Interestingly, if Hide; is replaced by Hide F3; in the example above, then after PopHide; only F2 and F3 become active again.
@vermaseren, what was the intended behavior when PushHide, PopHide, and Hide are mixed in this way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions