#Import with `-file`

18 messages · Page 1 of 1 (latest)

prisma adder
#

I have a.odin and b.odin:

// a.odin
package a

some_proc :: proc() {}
// b.odin
package b

import a

main :: proc() {
  a.some_proc()
}

and when I try to compile b.odin with -file, it fails with a Path does not exist: a error. Why does that happen, and what can I do about it?

river flower
#

Because you asked to import a file, and not a directory.

#

AND .odin files within the same directory must have the same package name.

prisma adder
#

buh

#

that's pretty annoying

river flower
#

Trust me, it's the opposite.

rose frost
#

import will always import a directory. You can't import just a single file. -file only applies to the file passed to odin build

prisma adder
river flower
#

Ill defined concept that does not scale

prisma adder
#

Hmm yeah, that might be true

river flower
#

There is a reason I defined things the way I did.

#

It's not a mistake.

prisma adder
#

Sure, and I trust you - but I don't need scaling here, I just wanted a few odin files that mostly do their own thing, but now I needed some stuff from another, which doesn't work

#

that's why it's a little annoying

#

not that big of a deal though, I'm probably better off refactoring before it becomes a mess anyway

river flower
#

If you only need a few files, you only need a single directory and thus a single package

#

And you'll never need to import anything either

#

It's that simple.