Am 10.08.2015 um 19:32 schrieb Adam D. Ruppe:
On Monday, 10 August 2015 at 17:27:56 UTC, Sönke Ludwig wrote:
 - Json.opDispatch and Bson.opDispatch are scheduled for deprecation

What was your reason for doing that? I find they are kinda convenient
but also have a way of messing with compile time duck typing so I
restrict it.... but overall, I still think they're kinda cool.

The main technical reason was CT reflections issues (the particular case was that they had always been erroneously recognized as input ranges) and the fact that any API change involving the Json struct would potentially be a silently breaking change. Another thing that I personally always felt was that the syntax had the effect of unconsciously hiding bugs, because it *looks* like static field access, so your brain thinks that the compiler checks for things like spelling mistakes.

My idea for solving this was to provide the basic Json type as pure abstraction for the data format, with standard D semantics (opIndex field access), while providing a separate type that transparently converts to/from the Json type and has all of the dynamic typing goodness (i.e. jsvar). So the difference would just be that it's an explicit request by the developer (that even saves on keystrokes if the type is just called "var") to enter the dynamic world and things get a little more obvious to the reader/reviewer.

Reply via email to