Skip to content

lower(m::Module) throws in v0.21 #415

@hhaensel

Description

@hhaensel

In GenieFramework we rely on rendering a Module as its String value, which JSON v1 perfectly does. However, v0.21 does throw an error.

In this transition period from JSON3 to JSON we still support JSON 0.21, but we cannot lower Modules as String, because its lowering is hard-coded in Writer.jl

I propose a small patch to allow for specialization of lower(m::Module) without breaking existing behaviour.

lower(m::Module) = throw(ArgumentError("cannot serialize Module $m as JSON"))

to

abstract type DummyModule end
# chose a Union type to make it possible to extend lower for Modules
lower(m::Union{Module,DummyModule}) = throw(ArgumentError("cannot serialize Module $m as JSON"))

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