4 ms·
I use D every day at work (inherited codebase) and the UFCS bothers me to no end. I try not to use it.
by gagege 5y ago
I use D every day at work (inherited codebase) and the UFCS bothers me to no end. I try not to use it.
- 0dyl 5y agoThat's understandable. Not for everyone. Different situation, but I do admit when I first got into D I was wary of the UFCS feature and I avoided it, too. Over time it felt a bit more natural and I began to appreciate it.
- schveiguy 5y agoThere are "bad" uses of UFCS, and good ones (sometimes depending on preference). For example, I hate code like `1.writeln`. The major feature that it provides is pipelining (as shown in the article)
- crazypython 5y agoAdding a method to a class you don't control is also useful.
- zombinedev 5y ago> I hate code like `1.writeln` Meh... after not more than my first month into D this syntax grew on me and now I just use `1.writeln` everywhere. More than a few years later, I can't think of a single issue this has ever caused me.
- jhvkjhk 5y agoCan you explain why? I have never used D, but I think UFCS is really convenient.
- p0nce 5y agoI don't know for GP, but UFCS functions just litter the auto-completion tab for me. It's also not always readable.
- jimbob45 5y agoCan you expound upon why you feel that way?
- gavinray 5y agoUFCS as a concept is fantastic but the one hangup is that D's language server implementation by the community and its IDE integration can't handle it because of the complexity. https://github.com/Pure-D/serve-d https://github.com/Pure-D/serve-d https://github.com/Pure-D/code-d https://github.com/Pure-D/code-d (I can't remember if the Visual Studio extension, VisualD handles UFCS or not) http://rainers.github.io/visuald/visuald/StartPage.html http://rainers.github.io/visuald/visuald/StartPage.html It's possible to implement, because Nim's language server handles UFCS, but atm D's doesn't do it (it's written pretty much by one people) So personally I avoid UFCS except for very simple/common function like "to!" because it breaks the intellisense for that call. Though if I knew the language inside and out probably I wouldn't care. It's still my "favorite" language. ----- SIDE NOTE: This single person wrote the D lang server, and has maintained it, written and maintained the VS Code extension, and other fundamental tooling + libs for years. https://github.com/sponsors/WebFreak001 https://github.com/sponsors/WebFreak001 If you use D and feel like sponsoring someone, consider sponsoring them, or Rainers (VisualD), or the maintainers or LDC or GDC, also single individuals for the most part. LDC Maintainer: https://github.com/sponsors/kinke https://github.com/sponsors/kinke GDC Maintainer: https://github.com/sponsors/ibuclaw https://github.com/sponsors/ibuclaw
- mhh__ 5y agoThe language server doesn't do it because it's only a parser whereas making UFCS work properly would presumably require a full semantic analyser. By no means impossible to do, just no one has taken the plunge yet.
- danielEM 5y agodo you have open vacancies? :-)
- iso8859-1 5y agoSymmetry Investments has vacancies with D: https://news.ycombinator.com/item?id=27034032 https://news.ycombinator.com/item?id=27034032