Readit News logoReadit News
sivizius commented on Rust's Ugly Syntax   matklad.github.io/2023/01... · Posted by u/matklad
arp242 · 3 years ago
What makes the Go code so verbose isn't so much that you have to type "func()", but rather that you need to list out all the types, as well as the need for an explicit return.

  squares := numbers.
      filter(func(x) { x >= 0 }).
      map(func(x) { x * x })

  let squares: Vec<_> = numbers.iter()
      .filter(fn(x) -> { x >= 0 })
      .map(fn(x) -> { x * x })
      .collect();
You don't necessarily need new syntax for this, although it may help with clarity.

The Rust => code is still a bit shorter, but not much and I don't think it matters much.

sivizius · 3 years ago
For the record:

    let squares: Vec<_> = numbers.iter().filter(x => x >= 0).map(x => x * x).collect();
is not valid Rust, but this is:

    let squares: Vec<_> = numbers.iter().filter(|&&x| x >= 0).map(|x| x * x).collect();

sivizius commented on Quantum winter is coming   backreaction.blogspot.com... · Posted by u/nsoonhui
kazinator · 3 years ago
Seems like the easiest way to use quantum mechanics to predict how a protein will fold might be to actually build that protein and watch.
sivizius · 3 years ago
yes, because watching molecules is easy…right?
sivizius commented on Zig-style generics are not well-suited for most languages   typesanitizer.com/blog/zi... · Posted by u/Ar-Curunir
sivizius · 3 years ago
Issue with unconstrained template-based approaches: Only static dispatch is possible which means, the compiler has to duplicate the procedure for all actual type-combinations and a procedure cannot return objects of different types, even though your are only interested in the interface they implement.

Well, you could if you either ensure, that the layout of the inherited part of a structure is the same for all structures, that inherit the same structure. Or you could return a tagged enum. However, with interfaces or traits, you just have to ensure that the table of interface/trait-methods of different types, that implement the same interface/trait. This table is constant and therefore a reference to it can be shared by every instance of the interface/trait.

Yes, it might be slower, because instead of direct method-calls, you have a layer of indirection, but you only need one copy of the method, not one for every type-combination. If all copies of this method have to fit in the L1-cache simultaneously but cannot, it might actually be faster.

sivizius commented on Leonardo Syndrome   thoughtfulatlas.bearblog.... · Posted by u/memorable
tartoran · 3 years ago
You make it sound like it is a bad thing when in fact it’s just the current perception in our modern super productivity culture. I sometimes wonder what would the world cultural heritage look like without the contribution of various people who we’d now pathologise with ADHD.
sivizius · 3 years ago
You seem to be the only one here pathologising ADHD.
sivizius commented on Leonardo Syndrome   thoughtfulatlas.bearblog.... · Posted by u/memorable
sivizius · 3 years ago
There is also another term for this: ADHD. Even though ADHD does not really have anything to do with attention, it is more of a motivation-issue, which can led to starting new, promising projects instead of finishing projects, because you find more and more obstacles.
sivizius commented on Nordstream: An Accident?   thelawdogfiles.com/2022/0... · Posted by u/h2odragon
jcranmer · 3 years ago
There is at least one factual inaccuracy here--Nordstream 1 was not cut off after Russia's invasion of Ukraine. It was running at more or less usual capacity until early June, when the flow was cut by about 60%. It was then shut off in July for regular yearly maintenance window. It returned at 40% capacity for a while, before being slowed to 20% capacity in late July, and then shut off again at the end of August. So Nordstream 1 has only been not moving for a little less than a month at the time of the explosion.

While I think accidental failure of the Nordstream pipeline is an underrated explanation, such a glaring factual inaccuracy makes me skeptical of the viability of the specific theory espoused in this article.

sivizius · 3 years ago
And he is talking about the diesel effect. This implies the presence of an oxidiser like oxygen. Yes, CH₄ + 2 H₂O does react to CO₂ and 4 H₂, but not under high pressure and it is endothermic, so nope. And this pipeline has an diameter of more than a metre, so this plug must be quite large. Yes, the pressure was 105 bar which is more than enough for the creating of these clathrates but this must be a lot of water o.o…anyway, I am not an expert, but this articles sounds a lot like he took a lot of knowledge from here: https://petrowiki.spe.org/Hydrate_plug_removal. But I like the idea. An deliberate attack is somewhat unsound for me, I do not see a reason for Russia to destroy both pipelines. NS1: ok, Russia tried to pressure Germany to open NS2 anyway. All 4 of them at different spots? At almost the same time? And if they maintained them all simultaneously (Why so fast? They have time now.), if one broke, they should have stopped anything on the other one, which exploded 17 h later. And this articles assumes a lot of incompetence on the Russian side…I do not buy this.
sivizius commented on Simple mix of soap and solvent could help destroy ‘forever chemicals’   science.org/content/artic... · Posted by u/ckcheng
sivizius · 3 years ago
KOH is not soap, it is used in the production of soap and KOH will make your skin to soap. Destroying anything organic by cooking it in strong lye at 120 °C with quite polar solvent is not something unexpected. It might be optimised with crown ethers or other phase-transfer catalysts, but I cannot see how this is a milder treatment than simple heating it until decomposition. To make this reaction affordable one has to extract/purify these forever-chemicals first. Otherwise, mostly other stuff will be destroyed. Lime (Ca(OH)₂) is somewhat cheaper in this quantities, maybe this reaction can be done with it. This will also bind any fluoride ions, which would make this way less toxic.
sivizius commented on What is our hidden consumption of microplastics doing to our health?   nautil.us/you-eat-a-credi... · Posted by u/dnetesn
GekkePrutser · 4 years ago
Yes and silicate is an environmental component that's well understood and our bodies have adapted to it because sand has been a thing forever. And glass is chemically inert.
sivizius · 4 years ago
Asbestos is a silicate…
sivizius commented on Seriously, Stop Using RSA (2019)   blog.trailofbits.com/2019... · Posted by u/goranmoomin
sivizius · 4 years ago
RSA is bad, because developers do not implement it as specified and ECC is good, because most developers will not implement it themself, because they do not understand ECC and therefor use libraries? IMHO a huge advantage of RSA over ECC is it is easy to explain. After you have explained the different kinds of elliptic curves and their pitfalls, you have to explain the integrated encryption scheme to actually use it for encryption. But ok, you want hybrid encryption with RSA too, but in theory, you do not have to.
sivizius commented on Melody – a language that compiles to regular expressions   github.com/yoav-lavi/melo... · Posted by u/losfair
sivizius · 4 years ago
So, a RegEx (melody syntax) to RegEx (unspecified syntax) compiler? I mean, the syntax is nice, but 1. please specify which kind of regular expression it compiles to, 2. are those really regular expressions or a language higher in the chomsky hierarchy? 3. I suggest to add a graphical output of the state machine, e.g. with graphviz.

u/sivizius

KarmaCake day288October 20, 2019View Original