On 2/27/13 7:36 AM, Niko Matsakis wrote:
### Treat empty structs the way we treat enum variants?

Perhaps we should just not parse a declaration like:
     struct X {}
instead one would write something like:
     struct X;
or
     struct X();
Much as you write
     enum Foo { Y }
This would be a "new-type" struct so X would also serve as a value, just
like the constant `Y` in the enum case.  This would mean that one never
writes a struct literal `Foo {}` but instead just `Foo`.

`struct X;` already works today. I implemented it a few months ago. It's used in sprocketnes, and a couple of places in Servo IIRC.

So I vote for disallowing `struct X {}` entirely.

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to