Syntax error on function call operator overload

I don’t see why I’m getting a syntax error on the following - to me it looks exactly like “function-like objects” section of Julia manual (v 1.0.2)

struct LDPC_Encoder
    Ksys::Int64
    K::Int64
    H_matrix::Array
    Zc::Int64
    BG2_sh::Array
    Npar::Int64
    LDPC_Encoder(Ksys::Int64, K::Int64, H_matrix::Array, Zc::Int64, BG2_sh::Array, Npar::Int64) = new(Ksys, K, H_matrix, Zc, BG2_sh, Npar)
end

function (enc::LPDC_Encoder)(c::Vector{Int64})
    in_pad   = vcat(c,  zeros(Int64, enc.Ksys - enc.K))# //Information  + Filler bits (as specified by Rel 15)
    ldpc_encoder_out = LdpcNREncode(in_pad, enc.H_matrix, enc.Zc, enc.BG2_sh, enc.K, enc.Ksys)
    println("encout:", ldpc_encoder_out)
    enc_output = RateMatchNR(ldpc_encoder_out, enc.Npar)
    return enc_output
end
julia> include("/home/nbecker/scma-ofdm-nr/ldpc_nr3.jl")
ERROR: LoadError: function type in method definition is not a type
Stacktrace:
 [1] top-level scope at none:0
 [2] include(::String) at ./client.jl:388
 [3] top-level scope at none:0
in expression starting at /home/nbecker/scma-ofdm-nr/ldpc_nr3.jl:203
… LDPC_Encoder … 
… LPDC_Encoder …

Those aren’t the same name.

1 Like