The Crystal Programming Language Forum

Require - clarification

Hi All

I’m just after some clarification on ‘require’ (I’m new to Crystal so still learning). The docs state that ‘require “foo”’ would look for foo in the standard library or in ‘lib’ (as either foo.cr OR foo/foo.cr). However when I require foo and foo is a Shard it will look in ‘lib/foo/src/foo.cr’ because the compiler knows foo is a Shard.

Is the above correct about Shards or have I misunderstood something.

cheers

Dave

Hi and welcome!

The docs are outdated. I just sent a PR to fix this: https://github.com/crystal-lang/crystal-book/pull/355

1 Like

Perfect - many thanks for the update. Thank you also for such a fantastic language.

cheers

Dave

It’s fixed now! :slight_smile: