Genie Discord forum

Author Avatarkk
10/27/2023, 5:03:15 PM

Hi, I've been testing an app that requires ComplexF64 data and noticed that this triggers InexactError when the reactive variable is a complex value. Here's an example:


@app begin
    @out this_triggers_InexactError = ComplexF64(1.0 +1.0im)
    @onchange isready begin
        @show this_triggers_InexactError

function ui()

@page("/", ui)
Server.isrunning() || Server.up()```

when I run Genie.loadapp(), it errors with:

julia> ┌ Error: 2023-10-27 09:54:30 InexactError: Float64(1.0 + 1.0im) │ Stacktrace: │ 1 Real │ @ ./complex.jl:44 inlined2 #construct#1 │ @ ~/.julia/packages/StructTypes/AK4aM/src/StructTypes.jl:327 inlined3 construct │ @ ~/.julia/packages/StructTypes/AK4aM/src/StructTypes.jl:327 inlined4 write(::StructTypes.NumberType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::ComplexF64; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) │ @ JSON3 ~/.julia/packages/JSON3/L8Yfy/src/write.jl:266 │ 5 write(::StructTypes.NumberType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::ComplexF64) │ @ JSON3 ~/.julia/packages/JSON3/L8Yfy/src/write.jl:251 ...

The error message seems to imply that Genie only supports Float64 not ComplexF64?
Author Avatarkk
10/27/2023, 5:05:03 PM

Changed the channel name: Can reactive variables be ComplexF64?

Author AvatarPere
10/30/2023, 10:10:15 AM

Thanks for the MWE! It made debugging this much easier.

Indeed, it seems that Complex type cannot be serialized and sent to the browser. You can define your own renderer as

Stipple.render(x::ComplexF64) = Dict(:re =>, :im =>

so that ComplexF64types are displayed in the browser. I've opened a new issue about adding support for this type to Stipple.jl

Author Avatarhhaensel
11/14/2023, 9:02:33 PM

I've released an alpha version of the Package StippleMathjs

Author Avatarhhaensel
11/14/2023, 9:05:06 PM

It's not yet registered so installation is a bit different. But you find all in the Readme or you try the demo at

Author AvatarPere
11/22/2023, 7:45:29 PM

@hhaensel those push and deps macros, where are they defined? I'd never seen them before and I can't seem to use them in my REPL

Author Avatarhhaensel
11/27/2023, 4:41:24 PM

@Pere could you get it to work. StippleMathks is meanwhile registered 🙂

Author AvatarPere
11/27/2023, 9:48:33 PM

@hhaensel I just tried it installing from the registry and it worked! looks great 😄