Re:Using D to Create the World’s Fastest File System
by sanxiyn on Wednesday December 05, 2018 @07:00AM
(#18607498)
> In D, . is used for both.
Yes, this is a great feature. Rust also does this, and I attribute substantial portion of ease of refactoring Rust to this feature.
Re:Using D to Create the World’s Fastest File System
by stochastic_monk on Wednesday December 05, 2018 @08:26AM
(#18607971)
Oddly enough, so does Cython.
Re:Using D to Create the World’s Fastest File System
by arunc on Wednesday December 05, 2018 @05:32AM
(#18607095)
> In D, . is used for both
This is an absolute pleasure to work with. Turtles (.) all the way down (pointers, values, modules, etc)!
Re:Using D to Create the World’s Fastest File System
by sdegutis on Wednesday December 05, 2018 @12:23PM
(#18610325)
Go also does this, although I never appreciated how useful it is until you made that point. Thanks for that. Also thanks for writing D, it was great to read through it's documentation, and I've been meaning to play around with it.
Re:Using D to Create the World’s Fastest File System
by Mindwipe on Wednesday December 05, 2018 @05:56AM
(#18607215)
Thanks, this was a good explanation of where the likely benefits originate for the use case in the OP!
Re:Using D to Create the World’s Fastest File System
by earenndil on Wednesday December 05, 2018 @04:15PM
(#18612635)
> In D, . is used for both
Also for module access (as opposed to :: in c++). I feel like d has a lot (too much?) of syntax but this is one place where it manages to cut down on it a bit.
Re:Using D to Create the World’s Fastest File System
by Doxin on Thursday December 06, 2018 @05:27AM
(#18616818)
D has significantly less syntax than C++, it barely has more than C. The weirdest syntax to get used to in my experience is the template stuff, most everything else is fairly natural. and even then the template stuff is way less complex (but no less powerful) than C++.
I've maintained C and C++ code bases for decades, and I've found that the first algorithm I tried has stayed there in the code. It gets tweaked, optimized, refactored, but it's the same algorithm and data structure.
With D, when I developed the Warp preprocessor, https://github.com/facebookarchive/warp I continually tried different algorithms & data structures to see which was faster.
One reason it's easier is that in C/C++ the . is used for value field access, while -> for pointer field access. In D, . is used for both. So you can easily switch between a value and a pointer to the value by changing little code.