Skip to content

Commit b9e98ae

Browse files
committed
Add support for "value" for SpecialExpr types
In particular, this lets us call "value" on instances of subclasses of String, Symbol, and Pseudocode.
1 parent 0fc397b commit b9e98ae

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

M2/Macaulay2/d/interp.dd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ value(e:Expr):Expr := (
538538
|| err.message == breakMessage then if err.value == dummyExpr then nullE else err.value
539539
else r)
540540
else r)
541+
is x:SpecialExpr do value(x.e)
541542
else WrongArg(1,"a string, a symbol, or pseudocode"));
542543
setupfun("value'",value);
543544

M2/Macaulay2/tests/normal/strings.m2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,4 @@ assert Equation(format(ascii(0..31) | "\"\\"),
8989
T = new SelfInitializingType of String
9090
assert Equation(net T "foo", "foo")
9191
assert Equation(format T "foo", "\"foo\"")
92+
assert Equation(value T "5", 5)

0 commit comments

Comments
 (0)