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

RepeatedNull[] ("...") has bug; causes $RecursionLimit execeded #974

Open
rocky opened this issue Oct 15, 2020 · 2 comments
Open

RepeatedNull[] ("...") has bug; causes $RecursionLimit execeded #974

rocky opened this issue Oct 15, 2020 · 2 comments
Labels

Comments

@rocky
Copy link
Member

rocky commented Oct 15, 2020

Split off from #970 so this can be found and tracked separately

This is how WMA handles ... (RepeatedNull):

In: RepeatedNull[a]//FullForm
Out: FullForm[a...]

In: a...
Out: a...

and this is what happens in Mathics:

In: FullForm["a"...]
Out: RepeatedNull["a"]

In: "a"...
Msg: | $RecursionLimit::reclim: Recursion depth of 200 exceeded.
Out: $Aborted
@rocky rocky added the bug label Oct 15, 2020
@rocky rocky changed the title RepeatedNull (...) has bug; causes $RecursionLimit execeded RepeatedNull[] ("...") has bug; causes $RecursionLimit execeded Oct 15, 2020
@rocky
Copy link
Member Author

rocky commented Oct 19, 2020

Here is what's going on as best as I can tell.

To format the result, because RepeatedNull is an operator (...) with precedence 170, Mathics is calling Expresssion formatting and produces:

Postfix`List[HoldForm[RepeatedNull["a"]]], "...", 170]

The infinite recursion seems to be on List[HoldForm[RepeatedNull["a"]]. List evaluates its arguments, and somehow it is not seeing the HoldForm so expression format of RepeatedNull[] is preformed over and over with Expression.do_format().

I tried creating a custom do_format() for RepeatedNull[] but that doesn't get called. It also looks like HoldForm[] doesn't have an opportunty to dictate what is done on do_format() either.

Were these to be hooked in, ether might be a way to address.

@mmatera
Copy link
Contributor

mmatera commented Oct 27, 2020

Partially addressed by PR #993

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants