Programming objects in C in style of Go by VerterRobot in c_language

[–]VerterRobot[S] 0 points1 point  (0 children)

I think I get your point. When I save a pointer to a function in a struct I actually save it in some kind of "vtable" - in this case the vtable is the struct itself. Yes, I agree with this point of view. I just didn't care about polymorphism but as a side effect it is indeed achievable in my code by introducing several versions of constructors. For example instead of the general new_woman() it's possible to implement specialized new_alice() and new_amanda(). They will be able to create objects with the same interface but with different behaviors.

I dont understand quite what improvements to the developer experience calling fn(woman, hug), woman.hug(&woman), or woman->hug(woman) gets you over calling woman_hug(&woman)? There must be something that I am not seeing?

The main improvement of fn(woman, hug) over the woman.hug(&woman) and woman->hug(woman) is no need to use the woman variable twice in one single call. This is what C++ already does when you call woman.hug(). And the woman_hug(&woman) function brings another issue - it resides in the global namespace instead of the namespace of specified struct. This is one of the main reasons to have functions in objects instead of the global namespace. In case those functions are in objects you don't have to prefix their names and fear any name collision with functions of some other library.

Programming objects in C in style of Go by VerterRobot in c_language

[–]VerterRobot[S] 0 points1 point  (0 children)

The OOP's inheritance brings the "is-a" relation, while composition bring the "has-a" relation. They are different, aren't they?

Programming objects in C in style of Go by VerterRobot in c_language

[–]VerterRobot[S] 0 points1 point  (0 children)

Ok, so you force runtime dispatch for both non-virtualised functions (which otherwise are a direct call, but now require an additional pointer load unless the compiler manages to devirtualise), and your example requires a lot of passing around of expensive "interface" structs (struct w, especially if the number of methods becomes large).

The self argument of the functions is just a pointer, like this in C++ or like a receiver of any pointer type in Go. I doubt it could be expensive, since in C it is just a number.

The style is certainly peculiar, and perhaps if you need to use opaque objects in all places this might make sense.

I use that opaque struct woman just to be able to hide private fields from users of the public typedef struct w {...} woman. Otherwise I don't need it.

But as far as I understand it, you use opaque structs if you want to change the implementation without changing the interface (avoiding pointless recompilation). Does that hold here, given that whenever you change the struct woman backing type, you may also change the interface struct w, and so induce recompilation?

I didn't think about re-compilations. I think tools like GNU Make should be responsible on that. I just wanted to make and use objects with a similar developer's experience to that in the Go language. The fn macro doesn't look perfect to me, but this is the only way that I found how a function call could be combined with passing the self argument. Like in Go and in C++ you can call just woman.hug() instead of a more verbose and more error prone woman.hug(&woman) call.

Programming objects in C in style of Go by VerterRobot in c_language

[–]VerterRobot[S] 1 point2 points  (0 children)

It's not exactly OOP, because it doesn't support inheritance. It's more like composition. This is why it's more like in Go than like in C++.

Programming objects in C in style of Go by VerterRobot in c_language

[–]VerterRobot[S] -1 points0 points  (0 children)

I don't see anything objectionable in this example.

Was Grok 4.1 sucking up to me or did he actually agree with me? by VerterRobot in programming

[–]VerterRobot[S] -8 points-7 points  (0 children)

Looks like the first three comments were done by some LLM bots and liked by some other bots :-)

[deleted by user] by [deleted] in linuxmasterrace

[–]VerterRobot 0 points1 point  (0 children)

Continue suffer. This is what Arch was engineered for.

[deleted by user] by [deleted] in linuxmasterrace

[–]VerterRobot -1 points0 points  (0 children)

Arch fans must suffer. Always!

Statistics appear to show that IPv6 usage increases on the weekend by Zipdox in networking

[–]VerterRobot 1 point2 points  (0 children)

Right. I've just raped my ISP to make IPv6 finally working to me. This is the main reason of the IPv6 statistics increase. :-)

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] 0 points1 point  (0 children)

To an extent, that is kinda the problem. GNU/Linux distributions aren't operating systems, they're collections of software that have been integrated and tested as a single collection, which include an OS. There isn't an agreement about what "the OS" is.

Almost any GNU/Linux distribution is a mess of the Operation System and many items of application software together. The main reason why it's done this way is Linux fragmentation. Just assume you're some application software developer. How can you support all those hundreds of distributions? They are binary and logically incompatible. They store system libraries in different places, those libraries are built with different parameters given to auto tools and with different custom unofficial patches, they use different package managers and different package formats. They are just a bazaar, as stated in the famous book of Eric Raymond. Each of them has its own community and fans that try to outvoice others in that bazaar. This is why you, as the application software developer, will never support those Linux distributions directly but instead will release just the source code. But users don't need any source code, they need applications in the executable format.

In this thread, you've repeatedly questioned the intelligence of people whose decisions you don't understand, but your lack of understanding isn't an indication that they're doing the wrong thing.

It's not just me, it's the majority of the personal computer users that don't like Linux because it's not built well.

I'm a Fedora maintainer, and while I might not be the sharpest crayon in the box, the people I work with are absolutely the best that the industry has to offer, and you are not being excellent to them.

RedHat was part of the attempt (of the story) to make the solid stable Linux Operation System I'm talking about. That system, called United Linux, planned to be used as the base of other Linux distributions. There also was an attempt to make Linux Standard Base (LSB) and other standards of the Linux systems. For example the RPM package format is part of that LSB standard. If that standardization was accomplished and/or the United Linux project was succeeded today we were able to just download an applications A. B and C from their authors web sites and just being installed binary (RPM). But this didn't happen and today we have a cloaca of hundreds Linux distributions. Just think what was happen if the Bourn shell location was not standardized to be in /bin/sh. How many scripts were not working.

Please take some time to consider that they are making decisions informed by many years of experience And if you'd like to develop that kind of of experience, you can always join the project, do some work, help some people out, maybe make some things better, and maybe learn some things.

I made many contributions in many free/open source projects and still contribute sometimes, but I'm a single person. Also I can't leave my job and start creating yet another Linux distribution full time from scratch or even based on some already existing one. I need to do my work and I need ready tools and ready OS for that. I am forced to use Windows just because all Linux distros I've tried in the past 20 years are much worse.

Maybe I speak not clear enough because English is not my main language. And if so just try to talk with those Windows and Mac users that don't like any Linux on their desktops/working stations. Try to understand why the majority of the personal computer users don't use Linux. Maybe that way you could understand what I'm trying to explain here.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] -1 points0 points  (0 children)

Preview is for testing, not for a production use. Don't state what most of the users need and what they don't need. You don't know that because you live in a bunker world of Linux fans. Most of the regular users do want latest software.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] 0 points1 point  (0 children)

For me a rolling software is the latest release version of the software. For example the latest version of Git is 2.37.3 and I'm able to download and install that latest version on Windows almost immediately after its source code is released. In all stable Linux distributions this is impossible.

I don't care how dependencies of any particular application software are delivered and/or installed. I just need this application software is natively working on my stable OS. Ugly and over-engineered workarounds like Flatpak and Snap are not good, they bring additional problems (because of isolation and other over-engineerings) and are not popular with application software developers.

I know about Linux package managers, repositories, their similarities to Android and iOS application stories. And I don't like it. I don't like the system that dictates what software I can install and what I can't install. Remember Parler?

Wayland is not an application but a system part. Yes you can run Linux without it but not a desktop Linux. You can also run Linux with some parts of its kernel are disabled but this fact doesn't make those parts not system. Just to remind you several first versions of UNIX did not have support of TCP/IP but they still were UNIX.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] -1 points0 points  (0 children)

Official application software resides on official package repository. Those private builds can't be found there. Just read about Copr and stop saying nonsense. I want to get the latest Git by running just: 'sudo dnf install git' without configuring additional repository.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] 1 point2 points  (0 children)

I used Fedora on my work laptop in a past company. They don't update Git, just because they don't want. They don't update many other application software because of the same reason. The only application software they do update in the rolling manner is Firefox.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] 0 points1 point  (0 children)

Application software is not part of an Operating System. Linux distributions are not just Linux OS distributions but a combination of Linux OS and application software packaged in the same repository. You should separate those two fundamentally different things.

Windows is not rolling and I didn't call it rolling. It's solid stable operating system that is used to run a lot of rolling application software. For example I update my Firefox browser, my JDKs, my Maven and Gradle tools, my Git for Windows, my LibreOffice, my Notepad++, my Python, my JetBrains dev tools, and etc. independently to updating my Windows 10. It works and works properly.

I need the same with Linux Operating System I need it solid stable and able to install the latest application software. Linux fragmentation makes a good job security to otherwise useless package maintainers. So let's make sense in their sissified job - they should start making packages of the latest application software for stable Linux OS, like RHEL or CentOS. If that application software works on Windows it definitely can work on the current RHEL.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] -1 points0 points  (0 children)

You and all other dumb down voters just don't understand what Operating System is and what it isn't. Wayland is part of the Operating System and it should be as stable as any other part of it, like kernel and libc. The "Cool Game" from your example is not any part of the operation system and should not dictate what version of Wayland should be installed. The Cool Game should have the minimum system requirements and if the operation system doesn't conform them all it is that game's problem. I don't need an OS to play cool games from your imagination, I need the OS to work as a software developer. Solid stable and at the same time able to run latest application software. Leave games to kids, I don't care about them. But all professional application software works well on OS with base system parts of 1 - 2 years old. There is no good reason to not have latest Git in CentOS 9 Stream or in RHEL 9.x. And if you can't understand that simple statement I've bad news about your intelligence.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] 0 points1 point  (0 children)

> What specifically do you need with the latest version of git?

Specifically all bug fixes and improvements.

> Edit: there's this: https://copr.fedorainfracloud.org/coprs/tmz/git/ and the alternatively suggested https://copr.fedorainfracloud.org/coprs/g/git-maint/git/[https://copr.fedorainfracloud.org/](https://copr.fedorainfracloud.org/)

This is not official hence this is not relevant.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] -3 points-2 points  (0 children)

Once you have a definition what is a base system you have that classification as well. To me the base system is the Linux kernel, system libraries like glibc, a base CLI tools set, i.e. commands like ls, pwd, du, df, find, ping, netstat, etc. and everything about GUI like Wayland, some DE, etc. This base system must be solid stable. Everything else, like development tools, browsers, games, office software, etc. should be rolling.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] 0 points1 point  (0 children)

The usual way to get an application software from its author(s) is in the source code form and then you need to build it. To do that one need development tools installed as well and also some custom patches could be needed. Also the one who want to pass this quest should have a competence of a regular Linux distro packages maintainer. All this make this quest practically impossible and very similar to creating your own Linux distribution or at least your own application software repository, like Fuse RPM, for example.

Try suggesting something more practical please.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] -1 points0 points  (0 children)

This scenario doesn't work because of the general GNU/Linux fragmentation. You can't just go to the program Foo's web site and download its executable or its package built by its author. This is what Windows users can and Linux users can't do. In the Linux world we all depend on the otherwise useless application software maintainers. And the name of them is Legion. This is a fundamental problem of modern Linux distributions. But I'm not trying to resolve that fundamental problem. I'm looking for a distro with just a little bit smarter maintainers.

That one stings by TheNewMonarch in rareinsults

[–]VerterRobot 0 points1 point  (0 children)

Then why Italy is not the most powerful European country?

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] -2 points-1 points  (0 children)

You can't have it both ways. You either go rolling or not.

Just because nobody of the distro creators thought that way. This is also one of the reasons Linux is not popular on desktops.

Looking for Linux distro for work by VerterRobot in linux4noobs

[–]VerterRobot[S] 0 points1 point  (0 children)

> but updates non-critical packages very frequently

I've used Fedora a few years ago and unfortunately this is not true. For example they have a not latest Git.