News for hackers. Stuff that matters.
Re:The use of `class` for things that should be simple free ... by Const-me on Thursday May 28, 2020 @06:43AM (#23335775)
> Is this better?

Very few professional developers code in vim or notepad. Vast majority of us are using IDEs. IDE knows types of things, type `myobj.` and you'll get a suggestion list with methods of that class callable from the current context.

> There is then a pattern to do this in C++ called pimpl

There's another useful pattern in C++:

    struct iObj
    {
        virtual ~iObj() { }
        virtual void cool_func( int a, int b, int c ) = 0;
        static std::unique_ptr<iObj> factory();
    };
Re:The use of `class` for things that should be simple free ... by mrep on Thursday May 28, 2020 @07:24AM (#23336028)
> Very few professional developers code in vim or notepad

Notepad++ and vim are the 3rd and 5th most popular development environment according to stack overflows 2019 report [0] and I and many others I know use Vim at least.

> IDE knows types of things, type `myobj.` and you'll get a suggestion list with methods of that class callable from the current context.

I've never used notepad but Vim absolutely supports omni completion [1].

[0]: https://insights.stackoverflow.com/survey/2019

[1]: https://vim.fandom.com/wiki/Omni_completion

Re:The use of `class` for things that should be simple free ... by jcelerier on Thursday May 28, 2020 @08:33AM (#23336483)
> Notepad++ and vim are the 3rd and 5th most popular development environment according to stack overflows 2019 report [0] and I and many others I know use Vim at least.

in C++ the ratio of ppl I know using an IDE with semantic code completion ability (that is, not rtags but actually using e.g. libclang or something that does understand C++ to some extent for IDE completion) vs "glorified text editors" must be 95/100 using an IDE though.

Re:The use of `class` for things that should be simple free ... by fnord123 on Thursday May 28, 2020 @10:07AM (#23337365)
Vim and VS Code have access to semantic code completion through the language server protocol.

But your assertion is weird. Either you work on Windows where everyone is on Visual Studio, or you have 95/100 people around you using CLion, XCode, and Qt Creator, two of which don't even have an entry on GP's survey link. One of which is probably only used to sign apps for ios. Could you give more info?

Re:The use of `class` for things that should be simple free ... by gpderetta on Thursday May 28, 2020 @10:30AM (#23337708)
I use emacs with clangd on a fairly large (~2M lines of code), but between clangd getting stuck, crashing or being too slow, I don't really get much benefits from it. When it works is great though.

TBH, in my limited experience, I have never seen code completion working well on large C++ code bases. I remember years ago VS literally becoming unresponsive when intellisense was enabled.

Re:The use of `class` for things that should be simple free ... by fnord123 on Thursday May 28, 2020 @06:51AM (#23335820)
https://www.cairographics.org/manual/cairo-cairo-t.html

All operations on `cairo_t` have prefix `cairo_`

Re:The use of `class` for things that should be simple free ... by Const-me on Thursday May 28, 2020 @07:08AM (#23335918)
That's doesn't give context for IDE. You can type `cairo_` and get suggestions what may follow, but you can't type `x.` and get suggestions on what you can do with x.
Re:The use of `class` for things that should be simple free ... by eternauta3k on Thursday May 28, 2020 @12:14PM (#23339002)
While PIMPL has additional indirection for accessing member variables, this pattern has indirection for accesing methods (need to go through vtable).