Author Topic: Rust is political?  (Read 4683 times)

0 Members and 1 Guest are viewing this topic.

Offline SiliconWizardTopic starter

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: Rust is political?
« Reply #25 on: May 21, 2022, 06:17:18 pm »
Rustaceans indeed. Rustlings are newbies. Like me. It's also a Rust languagd tutorial project https://github.com/rust-lang/rustlings/

Ah, OK! ;D

I suggest the difference between Rust and C++ is Rust is loaded with a suPPa excitted developer community that's just suPPa excitted!!!!!

That seems so.
But to be completely fair, just have a look at CppCon talks. And then at Rust conference talks. There's pretty fun stuff in both. Granted the Rust crew sounds a bit more excited.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Rust is political?
« Reply #26 on: May 21, 2022, 08:27:36 pm »
Feels outdated to me, then.  The usual things that people would consider "political" include merely discussing topic related to the above; while the above definition seems to suggest only literal politicians do any politic.  Which is a bit absurd with respect to how I've seen the word used.
I disagree, but I'm not a native English speaker anyway.

Discussion about governance and rules is political, of course.  Supporting or opposing a course of action done using taxes is about governance, and thus political.

Tools are not political.
The users and developers of software are political though.

Open source developers tend to be more left-leaning. Writing software so it can be shared with everyone, to benefit society is a socialist principle. This is bound to affect some of the decisions made and how the documentation is worded.
 
The following users thanked this post: T3sl4co1l, MK14

Online coppice

  • Super Contributor
  • ***
  • Posts: 8637
  • Country: gb
Re: Rust is political?
« Reply #27 on: May 21, 2022, 08:34:29 pm »
Open source developers tend to be more left-leaning.
I've never found this to be true. However, if you get some momentum with an open source project a lot of political hangers-on will try to muscle in and make life a misery for the productive people. Too many productive people are too timid to tell the scum just where to shove it.

 
The following users thanked this post: MK14, brucehoult

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4527
  • Country: gb
Re: Rust is political?
« Reply #28 on: May 21, 2022, 08:36:20 pm »
The users and developers of software are political though.

Open source developers tend to be more left-leaning. Writing software so it can be shared with everyone, to benefit society is a socialist principle. This is bound to affect some of the decisions made and how the documentation is worded.

Not necessarily, it can work BOTH ways.  Some open-source projects (free), seem to have partially capitalistic (right-leaning), reasons for open-sourcing (and making it available for FREE).  Because they use other ways of generating money, in a business sense.
Such as selling support (e.g. SQLite), full-commercial-use-and-modify-source-code-privately-licences (for money, e.g. QT), etc.

Or alternatively, a significant proprietary/business, may have its own reasons, for wanting free versions, to be freely available.  E.g. Microsoft, making web browsers, available for free.  As (it was rumored/believed by some) they were worried, that if companies could become large, by making big profits from web-browsers, they could compete/harm Microsoft's profit line.
« Last Edit: May 21, 2022, 08:40:18 pm by MK14 »
 
The following users thanked this post: Zero999

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Rust is political?
« Reply #29 on: May 21, 2022, 09:18:01 pm »
The users and developers of software are political though.

Open source developers tend to be more left-leaning. Writing software so it can be shared with everyone, to benefit society is a socialist principle. This is bound to affect some of the decisions made and how the documentation is worded.

Not necessarily, it can work BOTH ways.  Some open-source projects (free), seem to have partially capitalistic (right-leaning), reasons for open-sourcing (and making it available for FREE).  Because they use other ways of generating money, in a business sense.
Such as selling support (e.g. SQLite), full-commercial-use-and-modify-source-code-privately-licences (for money, e.g. QT), etc.

Or alternatively, a significant proprietary/business, may have its own reasons, for wanting free versions, to be freely available.  E.g. Microsoft, making web browsers, available for free.  As (it was rumored/believed by some) they were worried, that if companies could become large, by making big profits from web-browsers, they could compete/harm Microsoft's profit line.
Good point. I admit I'm basing my experience on a now defunct, pro-Linux/anti-Microsoft forum, I used to post on many years ago, back when Internet Explorer was king. Many of the people where, who were involved in developing open source projects, had left wing views, which I suppose shouldn't have been surprising.
 
The following users thanked this post: MK14

Offline SiliconWizardTopic starter

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: Rust is political?
« Reply #30 on: May 22, 2022, 01:55:13 am »
Feels outdated to me, then.  The usual things that people would consider "political" include merely discussing topic related to the above; while the above definition seems to suggest only literal politicians do any politic.  Which is a bit absurd with respect to how I've seen the word used.
I disagree, but I'm not a native English speaker anyway.

Discussion about governance and rules is political, of course.  Supporting or opposing a course of action done using taxes is about governance, and thus political.

Tools are not political.
The users and developers of software are political though.

Open source developers tend to be more left-leaning. Writing software so it can be shared with everyone, to benefit society is a socialist principle. (...)

This is a questionable generalization IMHO. People may have myriads of reasons for open-sourcing or not open-sourcing some project. What you said here is just one possible reason among many.
While sure, some people may do it solely for the greater good of society with all pure intentions (which you may or may not associate with political left, which would be yet another debate), a very common reason some people decide to share source code is to potentially get a full team of developers for free. Both reasons are not even contradictory, of course, but the latter happens to often prevail. From my experience anyway.

That said, I do agree that open-source inevitably comes with some politics. But that's the point of this thread: I absolutely do not agree with the fact that "tech is political" in general. As I said earlier, political tech is political. With your example, choosing a license for a given project certainly has a political aspect to it. Choosing a license is the political act here, if you want to see one. It's not the underlying tech that is being developed (except in the very rare cases for which said project would be clearly dedicated to some political battle, then sure, but this can't be the case for a general-purpose language, unless we've been lied about the fact that it was one.)

Just a thought.
 
The following users thanked this post: MK14

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6242
  • Country: fi
    • My home page and email address
Re: Rust is political?
« Reply #31 on: May 22, 2022, 03:20:54 am »
Open source developers tend to be more left-leaning.
I haven't seen any statistics on that, so I don't know which way devs tend to lean.  I personally suspect that the age-related distribution (youngsters tending to lean more to left, older more to right, as their personal situations and experiences change) is stronger than developer licensing choices.

Writing software so it can be shared with everyone, to benefit society is a socialist principle.
Only on a surface level –– but that is definitely not the reason I ever choose to apply a "copyleft" license.

The core of socialism is social ownership of the means of production, as opposed to private ownership.  Those who respect copyrights, know that the only one who can choose to distribute software under a different license than the original, is the author.  (In cases where there are multiple authors, they all must agree.)  Therefore, the very core of copyright licenses is based on copyright law and private ownership.

True socialists would never respect copyright!  They would consider software to 'belong to the people' anyway.

Consider the Free Software movement championed by RMS.  It is not about the software having zero price, or that it is available to all.  It is about the end users that have obtained the software to have the liberty to run and modify the software, to have full control over their hardware.  At its very core, it is not social or socialist, it is really libertarian instead.

(In political terms, you have a big difference between GPL and BSD licenses.  GPL allows distributing derivatives under the same license –– share-alike; sources must be available to those you distribute the derivative to ––, but BSD licenses typically do not require sources to be distributed as well.  Thus, one could argue that GPL is viral and capitalistic because it emphasizes the rights of the original author and end users, but not other developers; whereas BSD emphasizes the rights of other developers.)

I use a number of different licenses all the time:
  • CC0-1.0: No copyright.
    I use this for all my examples (although I sometimes forget to explicitly mark them so), because I want others to use that or similar code to solve specific problems.  I don't do it because I think it will make the world a better place; I use it in the hopes of having less buggy software at my fingertips.  Pure enlightened self-interest.
  • BSD Licenses: Permissive licensing.
    I use these for device drivers, in the hopes that I can in the future use that device (which I obviously already own) on different operating systems also.  The driver is required but not commercializable: it is not feasible to charge separately for both the device and the driver.
  • LGPL: Share-alike, but dynamically linkable to proprietary software.
    I use this for libraries.  I maintain the copyright and can sell individual licenses (other than LGPL) for commercial purposes, but others can use the unmodified sources, or by providing also the modified sources of the library to those they distribute the modified libraries to.  As shown by the Qt Company (a Finnish one, BTW), this can be a working business model.
    The reasons for doing this vary.  I am quite self-centered, so I usually do this because I believe that applications that use my library will be less buggy, and therefore more comfortable and nice for me to use.
  • GPL: Share-alike.
    I use this for applications I do not charge money for.  There are two main reasons for this: one is when I get paid by someone to create the application or tool.  (That makes sense the same way co-operatives work: the client is assured that they can continue to develop and modify the tools to fit perfectly to their needs.  I do and must provide sufficient documentation for this, though.)  The other is when I believe the tool or application can make things better for me somehow.  Not necessarily directly; it can for example open up completely new avenues for me to be paid to create such tools.
  • Proprietary licenses, for COTS and other paid software.
    Even with these, I really like giving more liberty to the end users (but not to re-distribute the software).  This is why I currently favour using e.g. Python 3 and Qt 5 for the user interface –– it being an interpreted language, an end user can make any changes to the user interface they want ––, and keep the important business logic and number crunching in native compiled code libraries.  A major reason for this is that if one provides user support in some sort of a forum, one can also collect and evaluate the changes end users ask for and have provided.  Instead of paying expensive consultants to hopefully come up with an user interface that end users like, you can make it a continuous process the users themselves help direct.  Not only it can be cheaper, but depending on your initial user base, it can significantly increase the lifespan of the product.
However, the most important point is how 'copyleft' developer communities work.

They are nothing like a socialist commune at all.  One could argue that they're extremely capitalistic, except that the exchange medium is not money, but time, effort, and knowledge.  (This is a very important point, because it is also the reason why so many people new to such communities get so frustrated with them.  People are used to customer support, and naturally initially try to treat developers the same way; and that will backfire.  Hell, we see the same here at EEVblog forums, whenever someone demands anything! ;D  And properly so.)

The advice I often give is perfect illustration of such communities.  I always tell people to provide maximum amount of information, and show that they have tried to find the cause of the problem themselves, and are willing to spend the time and effort to diagnose, test, and fix the problem.  The developers will ignore you otherwise, because time and effort is the 'money', and they don't want to waste theirs.  Now, if there is a bug to be fixed or an enhancement to be implemented, it will help everyone; true.  But the developers are not interested in everyone, they're interested in what they themselves use, and what their users (in the same organization, or otherwise the people paying for the developer for their time and efforts) use.  Essentially, they're only concerned about the subset of everyone that directly implicates themselves.  Being somewhat logical –– kinda-sorta requirement for an efficient developer! –– they know that everyone includes myself and those who pay me, and is the impetus for doing the work.

The fact that others in everyone benefits, is just an ancillary reason, and is related to the secondary feature of such developer communities; the co-operativeness.  Basically, because the cost of a copy is zero (but the cost of having an end-user is negative, as they usually need some sort of support  but do not contribute anything themselves), having other developers contribute is a net positive for each individual developer.  It is a very commercial/capitalistic/individualist approach, that just happens to look like 'socialism' on the surface.

(The difference between co-operatives and actually socialist organizations like sovkhozes or kolkhozes or even the socialist kibbutzim in Israel (1927-1991), is that the latter do not work long-term, whereas the former, working on capitalistic principles –– being an enterprise –– reducing the costs of production by sharing amongst the participants, do.)

(I think I explained all this poorly, but that's only because of my not-so-good language skills, not because there is anything hazy about the stuff I'm describing.  I'm just so used to it, having integrated this into my operations profile almost two decades ago, it's like breathing to me.)
 
The following users thanked this post: Zero999, JohnG, MK14

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6242
  • Country: fi
    • My home page and email address
Re: Rust is political?
« Reply #32 on: May 22, 2022, 03:36:56 am »
That said, I do agree that open-source inevitably comes with some politics.
Perhaps in the sense that it often requires a politically-laden discussion to explain why one might choose open source.
It is not inherently a political decision: for me, it is very simply a question of enlightened self-interest.

(That enlightened part is not about some higher cause or belief, but about the fact that some choices can have wide-ranging and long-term effects, and to make properly sane and rational decisions beneficial to oneself, one must look at those wider, less easy to observe effects too.)

Because of this, I'd be willing to admit that open source is a philosophical choice (as it involves things like long term benefits over short term benefits; ethics over morals or legal obligations). 
But not an inherently political one.
It only involves politics when people do not understand the commercial reasons for choosing open source, and insist on mixing politics with it.

Or does 'political' include ethics and philosophy, too?  I don't think so, because ethics and philosophy is personal.  I've chosen mine based on what I think will work for me best, considering my personality and other features.  I'd hate if they were included in governance; it'd be like enforcing by law which hand you use a fork with when eating.
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4527
  • Country: gb
Re: Rust is political?
« Reply #33 on: May 22, 2022, 04:47:27 am »
I find this statement concerning:
Quote
Rust believes that tech is and always will be political
https://twitter.com/rustlang/status/1267519582505512960

The following video (just watching a minute or so of its 5 Min 39 sec length), gives a fair bit of the gist of it.  I like the way the author, explains that the Rust Language Development team, should be a "Programming development team", first and foremost, and NOT try to be something they are not, which is a political activist group.

He also points out, that history seems to show, that pushing too hard for changes like that (political), can lead to a revolution.  Which can cause lots and lots of deaths.  Because not everyone will be happy/willing, to accept all the various changes, the revolution causes.

If anyone in this thread considers themselves a programmer/developer.  Then making their language choice(s), based on the primary political objectives of the programming language.  May NOT result in the best and most optimal choice of programming languages.

« Last Edit: May 22, 2022, 04:50:21 am by MK14 »
 

Offline Fredderic

  • Regular Contributor
  • *
  • Posts: 68
  • Country: au
Re: Rust is political?
« Reply #34 on: May 22, 2022, 05:32:56 am »
Have to say, when I first heard that comment about Rust being political, I assumed they meant "political" as in "polarising".  I've had the sense people are kind of using the word that way a bit of late.  Not so much about involving politics, but more that people feel the same way about something, as they do about their politics.  Or about how people are making choices on a thing based how it "feels", rather than it's technical merits — Rust being a language with a definite "feel" to it, much like Python with it's indenting thing, I can imagine could be described as "political" in this way.

I hoped that was what they meant, in any rate.  The comment about helping out in the community gives me some pause, but I could imagine it more as, "help out the Rust community, so people can see it's merits beyond it's weirdness", or such.

My personal take on Rust, is that I strongly disprove of large companies using their name to promote an upstart tech over existing (and in my mind better) underdogs that simply never had support from someone with such clout; Go and Rust being the prime examples.  Neither, I think, bring anything particularly new or special to the table that would have elevated them so far so quick on their own merits, they were simply thrust there by the backing of a high-profile organisation.  (Emphasis there, because Rust kind of does have something "special", I just don't think it'd have had the uptake it has, left to find it's own feet like most other languages have.)

Are we certain (I have not had the inclination to dig in to the topic, beyond the discussion here) that is not what they meant?
 

Offline MadScientist

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: 00
Re: Rust is political?
« Reply #35 on: May 22, 2022, 06:59:29 am »
Everything is political because humans are political creatures.  Computer languages are very much a political creation , often embodying the political perspectives of their creators. “Politics” of course is much more then governance or “politicians “ or what the TV calls politics
EE's: We use silicon to make things  smaller!
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6242
  • Country: fi
    • My home page and email address
Re: Rust is political?
« Reply #36 on: May 22, 2022, 07:53:36 am »
“Politics” of course is much more then governance or “politicians “ or what the TV calls politics
Okay.  Could you define “politics”, then?  Or at least how it differs from “culture” or “social”?

People keep claiming "politics" means something different than what the dictionaries say, but refuse to define it themselves.
To me, that indicates they have no idea of what they are actually talking about, and are simply describing their personal feelings and beliefs.
That is useless, because your feelings and beliefs do not matter.  Neither do mine.  What matters, are the reasons behind them; those we can discuss in an useful manner.  To do that, we do need the definitions.
 
The following users thanked this post: MK14

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: Rust is political?
« Reply #37 on: May 22, 2022, 10:27:49 am »
Open source developers tend to be more left-leaning. Writing software so it can be shared with everyone, to benefit society is a socialist principle.

Being forced by society to share the result of your labour would be socialist.

Choosing for yourself what to share and what to keep private is the free market and self ownership in action.

The economic right (free market, libertarian) are NOT against sharing or cooperation. They are against FORCED sharing and cooperation.
 
The following users thanked this post: langwadt, coppice, Karel, RoGeorge, MK14, george.b, james_s, Jacon, eugene, SiliconWizard

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: Rust is political?
« Reply #38 on: May 22, 2022, 11:08:19 am »
Open source developers tend to be more left-leaning. Writing software so it can be shared with everyone, to benefit society is a socialist principle.

Being forced by society to share the result of your labour would be socialist.

Choosing for yourself what to share and what to keep private is the free market and self ownership in action.

The economic right (free market, libertarian) are NOT against sharing or cooperation. They are against FORCED sharing and cooperation.

Exactly this. I shared a considerable amount of free software (free as in speech, not as in beer) because I wanted to.
If somebody tells me that I should opensource also some of my closedsource software or if they tell me to use a specific license,
I tell them politely to <***> themselves...
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4527
  • Country: gb
Re: Rust is political?
« Reply #39 on: May 22, 2022, 11:38:34 am »
Everything is political because humans are political creatures.  Computer languages are very much a political creation , often embodying the political perspectives of their creators. “Politics” of course is much more then governance or “politicians “ or what the TV calls politics

You are 159% right, so there is NO need for me to be sarcastic, in my reply.

Next year, I'm hoping to vote for the COBOL related parties.  That should keep the country running nicely!
Otherwise FORTRAN, based on their websites latest political views.

TL;DR
Yes, you can argue that EVERYTHING is related to politics.  But that doesn't mean that everything should declare their political affiliations.

Can I choose between 1k, 10k and 47k resistors.  Or do I need to go on the respective websites for those parts, to check out their political views/declarations first?
To Customer:  I'm very sorry the LED lights up so dimly.  I originally specified a 1k series resistor, which would have lit it up, just fine.  But one of the stated political views, on the 10M Ohm resistors website caught my eye.  So I designed that in, instead.  Because EVERYTHING is political.
 
The following users thanked this post: Karel

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 493
  • Country: us
Re: Rust is political?
« Reply #40 on: May 22, 2022, 02:18:31 pm »
All this fuss over something that a stranger wrote on twitter.
90% of quoted statistics are fictional
 
The following users thanked this post: JPortici, cfbsoftware

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Rust is political?
« Reply #41 on: May 22, 2022, 07:32:14 pm »
To Customer:  I'm very sorry the LED lights up so dimly.  I originally specified a 1k series resistor, which would have lit it up, just fine.  But one of the stated political views, on the 10M Ohm resistors website caught my eye.  So I designed that in, instead.  Because EVERYTHING is political.
In the UK, red LEDs are Labour, blue are Conservative, yellow are Liberal, green are obviously the Green Party, purple are UKiP, pink are anything pro-LGBT and white are a far-right white supremacist group.
« Last Edit: May 22, 2022, 07:49:18 pm by Zero999 »
 
The following users thanked this post: MK14

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4527
  • Country: gb
Re: Rust is political?
« Reply #42 on: May 22, 2022, 07:49:00 pm »
In he UK, red LEDs are Labour, blue are Conservative, yellow are Liberal, green are obviously the green party, purple are UKiP, pink are anything pro-LGBT and white are a far-right white supremacist group.

Also, Flashing LEDs are the PRO People 'Flashing' in public party   :-[  (did I just make that up?), UV LEDs are the Ultra-Violent party (possibly connected to Russia), Infra-red LEDS are for the rejoining with the EU party.  Anti-glare LEDs, are in support of the Anti-abortion party, RGB-multi-coloured LEDs are for the multi-culture party, and the fake/faulty/poor-quality/funny-looking ones, are in support of the Chinese party.

The IR-LEDs (Infra-Red) are for the Irish party, the one with a built in solar-cell, also is for the Green party.  The hyper-vacuum tube type (based on the latest Valve/tube technologies), is in support of the Elon Musk (Boring Company) Party.  The super micro-miniature, yet made out of soft materials one, is the Micro-Soft Party one, as is the tiny LED, with 11 tiny glass panes in it, Windows 11, Microsoft party as well.

The Linear-LUX LED, or LIN-UX for short, is for the Linux party (now allowed, as programming languages are allowed to be political).
 

Online magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Rust is political?
« Reply #43 on: May 22, 2022, 07:57:04 pm »
Of course IT is political, otherwise nobody would seriously consider Rust significant enough improvement over C to justify jumping on the bandwagon. But they are being loud enough, apparently.

Consider something as simple as the C library qsort function, which takes an array of any type and a comparator function for that type and sorts it. Of course this being C, you can call the function on an array of float with a comparator taking arguments of char and int and returning a function pointer. And there is tons of other generic code like that, and bugs when somebody gets the types wrong.

It's year 2022, and you still can't do it safely in an imperative language which claims to be the next generation C/C++, but you can do it in a dumbed down OO language for applications, like Java/C#.
 
The following users thanked this post: Karel, MK14

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: Rust is political?
« Reply #44 on: May 22, 2022, 11:24:38 pm »
Consider something as simple as the C library qsort function, which takes an array of any type and a comparator function for that type and sorts it. Of course this being C, you can call the function on an array of float with a comparator taking arguments of char and int and returning a function pointer. And there is tons of other generic code like that, and bugs when somebody gets the types wrong.

That's a bug but it's a bug that doesn't get very far before it is caught. Any reasonable unit testing is going to catch it.
 
The following users thanked this post: MK14

Offline SiliconWizardTopic starter

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: Rust is political?
« Reply #45 on: May 23, 2022, 02:04:15 am »
Consider something as simple as the C library qsort function, which takes an array of any type and a comparator function for that type and sorts it. Of course this being C, you can call the function on an array of float with a comparator taking arguments of char and int and returning a function pointer. And there is tons of other generic code like that, and bugs when somebody gets the types wrong.

That's a bug but it's a bug that doesn't get very far before it is caught. Any reasonable unit testing is going to catch it.

Yes, this particular kind of bug has zero chance of not getting caught unless you do no testing at all. In other cases though, problems can get more subtle.
But sure, generally speaking, function pointers in C can cause all kinds of bugs, and genericity can only be achieved through either macros or function pointers, with "typeless" pointer arguments (void *), which give no possibility of compile-time checks. That's life.

I think magic was kinda implying that Rust didn't do any better for generic programming than C, which I don't think is true. I don't like Rust (after having taken an honest and longish look at it), but it certainly has better support for generic programming than C.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2217
  • Country: 00
Re: Rust is political?
« Reply #46 on: May 23, 2022, 06:23:40 am »
Unfortunately, I find the main problem is that "a bad programmer can write bad code in any language",
to paraphrase the famous saying. And most programmers are pretty bad.

Good programmers avoid unsafe practices anyway, so new and better languages don't provide the advantage that was hoped for.
 
The following users thanked this post: MK14

Online magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Rust is political?
« Reply #47 on: May 23, 2022, 07:26:10 am »
Consider something as simple as the C library qsort function, which takes an array of any type and a comparator function for that type and sorts it. Of course this being C, you can call the function on an array of float with a comparator taking arguments of char and int and returning a function pointer. And there is tons of other generic code like that, and bugs when somebody gets the types wrong.

That's a bug but it's a bug that doesn't get very far before it is caught. Any reasonable unit testing is going to catch it.

Sorting is a trivial example and can be tested, provided that the testing is adequate - a test that only tries to sort "2,3,1" will never catch that the comparator's type is short instead of int.

And we can do better. A major application of generics is containers, so consider hashmap<int>. Of course, you can store a float in such container and it will still work just fine. The code which works with this hashmap normally will pass its unit tests and the code which incorrectly stores float in it also will, but the two pieces are not going to get along very well. So you will need a little higher level testing to catch it.

And, of course, there is many projects that don't do unit testing at all. Including some major open source software, which the fanboys insist should be rewritten in Rust. But generics, including containers, still suck in that language like in all of its predecessors. You have a choice between C++ templates (pointless code duplication), virtual tables (individually added to each object in the container) or good old C void pointers. They call it progress.

There is no reason why a modern low-level language couldn't have space-efficient containers which, for example, take an extra argument always forced to be sizeof(T) to deal with different types, other than that their type systems are still universally stuck in the stone age of 1960s. Ultimately, Rust is just Mozilla's favorite subset of C++ with a syntax change so that you can't use C++ features they don't approve, plus one novel functionality of improved memory management.

but it certainly has better support for generic programming than C.
Hardly better than C++, though. Which is another thing they say they want to replace.
 

Online DiTBho

  • Super Contributor
  • ***
  • Posts: 3911
  • Country: gb
Re: Rust is political?
« Reply #48 on: May 23, 2022, 10:09:50 am »
A great way to catch bugs in C is to structure the code in a way the ICE can use artificial intelligence to follow a test-case draft.

Otherwise, the engineering-staff needs to be separated from the testing-stuff, they don't have to communicate at all, except
  • from the engineering-staff: "this is the latest versioned xyz project, these are constraints, have fun"
  • and the reply from the testing-stuff "we tested, here it is the bugs-list found, code rejected, have fun too fixing stuff"
(
don't forget to add figurative fingers on each step, just to emphasize that each group wants to prove that they are the best, and all problems are from the other group
)
to prevent the parties from affecting each other

Human being brains are affected by bias, bias makes you blind, and needs time and rigor in order to compensate

Artificial Intelligence is better here because it can test millions of things to compensate the bias.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: Rust is political?
« Reply #49 on: May 23, 2022, 11:33:33 am »
But generics, including containers, still suck in that language [Rust] like in all of its predecessors. You have a choice between C++ templates (pointless code duplication), virtual tables (individually added to each object in the container) or good old C void pointers. They call it progress.

C++ templates don't require code duplication. Even if the compiler generates multiple functions, if they have identical machine code the linker will combine them into one. If you write the C++ templates as type-safe wrappers around the same void pointers you'd use in C then the machine code will all be the same.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf