digitalmars.D - Deprecate static opCall for structs?
- Bill Baxter (11/11) Nov 20 2009 We now have struct constructors that do basically the same thing as a
We now have struct constructors that do basically the same thing as a static opCall. Non-static opCall should still be ok, for implementing functors, but I think having static opCall is just too confusing given struct literals / struct constructors. Right now struct S; S(1,2) ; could be 1) a static opCall, 2) a constructor call 3) a struct literal That seems too many things sharing the same syntax to me. --bb
Nov 20 2009
Bill Baxter wrote:We now have struct constructors that do basically the same thing as a static opCall. Non-static opCall should still be ok, for implementing functors, but I think having static opCall is just too confusing given struct literals / struct constructors. Right now struct S; S(1,2) ; could be 1) a static opCall, 2) a constructor call 3) a struct literal That seems too many things sharing the same syntax to me.I'd vote for removing struct constructors and static opcalls, and to fix the struct initializer syntax (so that it can produce struct literals).--bb
Nov 20 2009
Hello grauzone,Bill Baxter wrote:Not going to happen, at run time, struct constructors superset struct literals. It should be possible to make them do the same at compile time.We now have struct constructors that do basically the same thing as a static opCall. Non-static opCall should still be ok, for implementing functors, but I think having static opCall is just too confusing given struct literals / struct constructors. Right now struct S; S(1,2) ; could be 1) a static opCall, 2) a constructor call 3) a struct literal That seems too many things sharing the same syntax to me.I'd vote for removing struct constructors and static opcalls, and to fix the struct initializer syntax (so that it can produce struct literals).--bb
Nov 23 2009