• 4 Posts
  • 82 Comments
Joined 1 year ago
cake
Cake day: June 20th, 2023

help-circle





  • solrize@lemmy.worldtoProgramming@programming.devSafe C++
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    4 days ago

    Dependent types only make sense in the context of static typing, i.e. compile time. In a dependently typed language, if you have a term with type {1,2,3,4,5,6,7} and the program typechecks at compile time, you are guaranteed that there is no execution path through which that term takes on a value outside that set. You may need to supply a complicated proof to help the compiler.

    In Ada you can define an integer type of range 1…7 and it is no big deal. There is no static guarantee like dependent types would give you. Instead, the runtime throws an exception if an out-of-range number gets sent there. It’s simply a matter of the compiler generating extra code to do these checks.

    There is a separate Ada-related tool called SPARK that can let you statically guarantee that the value stays in range. The verification method doesn’t involve dependent types and you’d use the tool somewhat differently, but the end result is similar.


  • Look on Starlink.com. I don’t expect it’s much worse than your typpical evil ISP or phone caerrier in terms of privacy. Certainly you could route everything through a VPN and that might help a little.

    Added: in the UK doesn’t it rain all the time? Maybe you just need some catchment area and a storage tank, instead of a well. Even rain barrels collecting runoff from your roof might do it. You DO want to purify the water. Rain water is full of microplastics now. :(



  • In Ada? No dependent types, you just declare how to handle overflow, like declaring int16 vs int32 or similar. Dependent types means something entirely different and they are checked at compile time. SPARK uses something more like Hoare logic. Regular Ada uses runtime checks.


  • Those security vulnerabililties are because of buggy old software, and updating the software in the old devices does as good a job of fixing the vulnerabilities as selling you a new device does. A significant e-waste tax on every new device, accompanied by credits for keeping old devices working, might help with that. Anyway, if it’s an app (rather than OS) vulnerability and you can’t fix it with an update because the new version of the app requires a new OS, that’s mostly likely an app that you don’t need to use. I’m getting by ok with F-droid apps instead of Play Store apps, for example.

    Best still would be to debug the software before shipping it, so it wouldn’t have those vulnerabilities in the first place. There are various forces that get in the way of that, but a significant one is that web development is now driven by delivering more advertising rather than useful information to the user.



  • In Ada, the overflow behaviour is determined by the type signature. You can also sometimes use SPARK to statically guarantee the absence of overflow in a program. In Rust, as I understand it, you can control the overflow behaviour of a particular arithmetic operation by wrapping a function or macro call around it, but that is ugly and too easy to omit.

    For ordinary integers, an arithmetic overflow is similar to an OOB array reference and should be trapped, though you might sometimes choose to disable the trap for better performance, similar to how you might disable an array subscript OOB check. Wraparound for ordinary integers is simply incorrect. You might want it for modular arithmetic and that is fine, but in Ada you get that by specifying it in the type declaration. Also in Ada, you can specify the min and max bounds, or the modulus in the case of modular arithmetic. For example, you could have a “day of week as integer” ranging from 1 to 7, that traps on overflow.

    GNAT imho made an error of judgment by disabling the overflow check by default, but at least you can turn it back on.

    The RISC-V architecture designers made a harder to fix error by making everything wraparound, with no flags or traps to catch unintentional overflow, so you have to generate extra code for every arithmetic op.




  • It would help if you gave some numbers. How much data, within a factor of 1000 say? A few megabytes? A few gigabytes? A few terabytes? A few petabytes? The approach you need will change depending on the level. What is your budget?

    What bothers you about cloud storage? Are any of the photos edgy?

    Anyway it sounds to me like you would be fine with a decent web hosting plan and a basic photo gallery app.



  • Chess has always been overwhelmingly male. In the old days there were separate men’s tournaments and women’s tournaments. That changed in the 1980s when Susan Polgar was by far the strongest female player in Hungary. She didn’t have any serious opposition in women’s tournaments there, and wasn’t allowed to enter men’s tournaments, so she started a big fight. The result was that men’s tournaments were abolished and they are now “open” tournaments that anyone can play in, though they are still overwhelmingly male. Women’s events exist basically so that female players don’t have to endure the gauntlet of a socially inept nerd sausage fest in order to play chess.

    For a while there was also something called “centaur” tournaments, where a centaur was a human player assisted by a computer. The idea was that the computer could outcalculate humans, but humans still had better strategic judgment, so a human-computer team could outperform either member individually. After a while though, computers became strong enough that human interference just made them play worse. The current strongest chess tournament in the world is called TCEC (Top Chess Engine Championship, tcec-chess.com) and it is always running, 24/7/365 unless something happens. Some really incredible games have come out of it.



  • Ding Liren is the current human “open” world champion, but there is also a women’s world championship, currently held by Ju Wenjun. Plus there is a world junior championship, world rapid championship, world blitz, etc. Magnus is probably still the world’s best human player, but he decided to drop out of the WC cycle because he got tired of winning it so often, basically.

    The strongest chessplaying entities in the world are entirely machines, which have surpassed humans by enormous and uncrossable margins. The top engine for the past few years has been whatever the latest version of Stockfish is. The top human players spend enormous amounts of time studying machine analysis of various openings and game positions.


  • You’re broadcasting to family who will likely be using gmail, so what difference does it make? Google will get all the emails either way. Anyway, logical argumentation is completely useless in a personal situation like that.

    If you want the address to be stable in the long term, you should probably use your own domain name instead of gmail or proton, if you’re not already doing that. After that, it’s possible to switch the hosting without changing the email address.