Skip to content

Make stack traces legible #6

@MasonProtter

Description

@MasonProtter

Currently, if you encounter an error in a LegibleLambda, the printing in the stacktrace is still not legible:

julia> using LegibleLambdas

julia> g =  x -> x + 1
(x -> x + 1)

julia> g("hi")
ERROR: MethodError: no method matching +(::String, ::Int64)
Closest candidates are:
  +(::Any, ::Any, ::Any, ::Any...) at operators.jl:560
  +(::T, ::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:87
  +(::UniformScaling, ::Number) at /Users/mason/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/uniformscaling.jl:145
  ...
Stacktrace:
 [1] (::var"#1#2")(x::String)
   @ Main ./REPL[2]:1
 [2] (::LegibleLambda{var"#1#2"})(args::String)
   @ LegibleLambdas ~/.julia/packages/LegibleLambdas/wGhDT/src/LegibleLambdas.jl:44
 [3] top-level scope
   @ REPL[3]:1

I guess what is needed would be to improve the printing of typeof(::LegibleLambda) which means that we'd have to store the requisite printing information in the struct itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions