Skip to content

UpValues associated to Atoms are not taken into account in evaluations. #1506

@mmatera

Description

@mmatera

Description

Differently than in WMA, Upvalues assigned to Atom types, like Real are not taken into account in evaluation

How to Reproduce

In[1]:= Unprotect[Real]; Real/:F[x_Real]:=x;F[3.]
Out[1]= 3.
$mathics -c 'Unprotect[Real]; Real/:F[x_Real]:=x;F[3.]'  

Output Given

Got F[3.]

Expected behavior

If the Upvalue were taken into account, the result -like in WMA- would be
3.

Additional context

We would like that atoms like ByteArray use UpValues for defining rules associated to Normal or Part, to make the code more modular.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions