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 {}.

2 Likes

I see. Now I know!