Skip to content

Commit

Permalink
Define nameof(::Variable)
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisonGrodin committed May 13, 2019
1 parent 92e3588 commit b975b4c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ end
(x::Variable)(args...) = Operation(x, collect(Expression, args))

Base.isequal(x::Variable, y::Variable) = (x.name, x.known) == (y.name, y.known)
Base.print(io::IO, x::Variable) = show(io, x)
Base.nameof(x::Variable) = x.name


Base.show(io::IO, x::Variable) = print(io, x.name)
function Base.show(io::IO, ::MIME"text/plain", x::Variable)
known = x.known ? "known" : "unknown"
Expand Down

0 comments on commit b975b4c

Please sign in to comment.