Irregular syntax for declaring an empty struct vs trait

The following code doesn't compile:

struct Person;

trait Nameable;

and requires changing the trait declaration to (use an empty block)

trait Nameable {}

Granted empty/marker traits may be rare, but it feels like the syntax is irregular. Is there a reason for this?

The struct syntax has an extra effect, of making Person usable as a value (a constant), not just a type.

I think all of the places where you can use ; in place of {} (this, trait functions, and mods, at least) give it a particular meaning, not just an equivalent to {}.


I see. Now I know!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.