Stream: beginners

Topic: Exposing abilities from modules


view this post on Zulip Austin Davis (Mar 14 2025 at 06:21):

So I know Abilities are going away, but in the meantime I have a question about them.

I was trying to refer to an Ability that was defined in a different module, but I cannot figure out how to do that. Right now, I get a compiler crash when I try to "expose" an Ability. It simply cannot be included in the module list of exposed items.

Is this intended behavior? Or is this simply a compiler bug (seems likely given the compiler crash)? If it's not a bug, then how can I access an Ability defined in a separate module?

view this post on Zulip Brendan Hansknecht (Mar 14 2025 at 06:24):

Did you expose all the fields of the ability as well?

view this post on Zulip Brendan Hansknecht (Mar 14 2025 at 06:25):

I don't think we have a good error message for this, but for example with Decoding:

Decoding implements
    decoder : Decoder val fmt where val implements Decoding, fmt implements DecoderFormatting

Both Decoding and decoder need to be exposed

view this post on Zulip Austin Davis (Mar 14 2025 at 06:26):

No, I didn't realize that was possible/necessary. That makes a lot of sense, though. Thanks for the tip!

view this post on Zulip Austin Davis (Mar 14 2025 at 06:27):

I suppose it would be nice to have the compiler handle that error gracefully with an error message, but since Abilities are being removed, that's probably too much to ask.

view this post on Zulip Brendan Hansknecht (Mar 14 2025 at 06:45):

Yeah, the compiler should handle it with grace, but no plans to fix at this point.


Last updated: Jul 05 2025 at 12:14 UTC