Accesing A Module's Structure

How does one access/create the structure Inode, defined below, from another module?

defmodule Cont.Expr do

  defmodule Inode do
    defstruct value: 0

inode = %Cont.Expr.Inode{}

Tried that and got:
(CompileError) Cont.Expr.Inode.struct/1 is undefined, cannot expand struct Cont.Expr.Inode

Actually I think this might be a problem with the Atom/Elixir because I can compile and run this code

inode =  %Cont.Expr.Inode{value: 1234}

IO.inspect inode

And it ouputs

%Cont.Expr.Inode{value: 1234}

And Atom/Elixir displays this:

(CompileError) Cont.Expr.Inode.__struct__/1 is undefined, cannot expand struct Cont.Expr.Inode

Where are you placing your files? How is you or your editor compiling them? mix compile?

1 Like

Yeah I’m using mix(mix to compile and I’m placing all the files in the projects lib folder which is generated by mix new main.

I would double check the file extensions. If that still does not work, can you push the project to Github or something that reproduces the error?

1 Like

Here you go. This reproduces the error I am having with Atom/Elixir.

I could not reproduce it. What is your Elixir version?

1 Like

My Elixir version is 1.3.3

I wonder if its a problem with the plugins with Atom because Eliixir will compile the code without complaint but the Atom editor+plugins will display the posted error message.

That sounds like it. Try filing a report on their elixir plugin/extension.

1 Like

I’m just glad that issue is solved(for me). Do you know how confusing it is to see an error pop-up in the editor indicating something is incorrect when it really isn’t?

Thank-you everyone for helping with this problem. I’ll file the report today.