Readit News logoReadit News
connicpu commented on Go is still not good   blog.habets.se/2025/07/Go... · Posted by u/ustad
gwd · 2 days ago
So sometimes you want it lexical scope, and sometimes function scope; For example, maybe you open a bunch of files in a loop and need them all open for the rest of the function.

Right now it's function scope; if you need it lexical scope, you can wrap it in a function.

Suppose it were lexical scope and you needed it function scope. Then what do you do?

connicpu · 2 days ago
You do what the compiler has to do under the hood: at the top of the function create a list of open files, and have a defer statement that loops over the list closing all of the files. It's really not a complicated construct.
connicpu commented on How much do electric car batteries degrade?   sustainabilitybynumbers.c... · Posted by u/xnx
WorldMaker · 5 days ago
Yeah, Level 1 charging is way too easily overlooked in the US. A lot of US parking lots could add simple Level 1 outlets to most lamp posts and do a lot, easily, for EV charging. (Most traditional halogen lamps were nearly Level 2 circuits, prior to recent switches to LEDs. If the LED transition had been timed a little different there might be way more L2 chargers "easily" installed in parking lots.)

A bit of an aside: I think part of the public perception problem is calling Level 1 "chargers" and not just "outlets". At so many points in our discourse, especially in the US, we've let car manufacturers sell us this idea of "gas-pump-like capital-C Charger" as something bulky and "hard/expensive to install", but really most EVs just need more wall outlets, classic, boring electrical outlets. Sure, the US can blame Edison that we don't have Level 2 as a default outlet and our cheapest/easiest outlets are Level 1, yet still we need to stop underestimating L1.

The other thing beyond "don't discount L1 as a reliable way to charge" (slow and steady charges the race car, eh) is "don't discount the power of destination chargers". Everywhere you park is a possible place for a charger. If you can't get one easily at home, maybe your employer can build one. Your grocery store and your church or bar or pickle ball court or other third place can build one. (Especially Level 1. Outdoor outlets have always been a thing, moving them a little closer to parking spaces shouldn't always be a big deal. Boring old electrical outlets are "everywhere" already, we just aren't always yet in the mode of thinking about them, their ubiquity, and how they can charge our cars, while we eat or shop or work or hang out or play or sleep.)

connicpu · 5 days ago
I think the biggest hurdle to just doing that is who pays for the electricity. Sure right now it's a nice perk you can provide your EV owning visitors that probably won't cost too much, but in a world where 10%+ of cars are EVs the costs will add up even at level 1, so you'll need to go for capital-C Chargers that come with payment infrastructure.
connicpu commented on How much do electric car batteries degrade?   sustainabilitybynumbers.c... · Posted by u/xnx
hedora · 5 days ago
We get away with level 1 chargers, and live far from the city. Residential lots could easily get away with one level one charger per spot. (The wattage is < 25% that of one level 2 charger, so you can put in 4x as many with the same backend connection to the grid.)

For city commuters, this would probably be more than good enough.

connicpu · 5 days ago
Yep absolutely, I used a level 1 charger at home for a couple years and it could easily recharge my daily work commute in about 5-8 hours (depending on season). Even now the only upgrade I did was move to a 240V16A charger because I wanted it to be a little quicker after long trips, but most of the time I limit the charge rate to 8A to preserve battery health.
connicpu commented on How much do electric car batteries degrade?   sustainabilitybynumbers.c... · Posted by u/xnx
kulahan · 5 days ago
Wow, I did not expect anyone to be offering a SIX HUNDRED THOUSAND mile warranty on their batteries. That's some serious confidence. I didn't see anything about it transferring, though. That would be smart on their end - the resale value for electric sports cars at least, is about 50% in the first year, then it levels off hard after that. This would encourage buying new, but not aftermarket. I'll have to look into this.

Still, while this removes a primary concern of mine, there's still one major hurdle that cannot be bypassed as far as I can tell (yet): If you have shared parking, there's essentially no way to charge your car. Maybe if it's an outdoor parking lot you can rely on solar power somewhat, assuming you're in a good situation for that?

Still, my point is that my parking space isn't actually mine, so I can't modify anything in the garage. Assuming superconductors aren't figured out any time soon, this appears to be an impossible solve, which cuts their consumer market significantly.

Also, not exactly the same thing, but they could remove those warranties and instead get some nice replaceable battery cells in there. Let me turn a thing to unlock it, pull out that one cell, and replace it. But maybe I'm a little more wrench-y than their customers want to be?

connicpu · 5 days ago
At my last apartment before I moved into a home where I did have the ability to install a charger, they had 4 EV chargering spots in the parking garage. I believe residents just had to pay the normal residential electricity rate to use them, they were standard commercial level 2 chargers like the kind you see in public parking lots.

All this to say, if the demand is there then shared parking structures will install them. I live in a city with a fairly high percentage of EVs, but it will continue to spread.

connicpu commented on The Folk Economics of Housing   aeaweb.org/articles?id=10... · Posted by u/kareemm
lcnPylGDnU4H9OF · 9 days ago
> people who buy those are leaving their old houses

I do not believe this is accurate, at least not in the last ~10 years or so. The houses are purchased by hedge funds and other smaller investors.

connicpu · 9 days ago
If you reach a point where housing supply out paces demand plus the vacancy rate those investors are willing to tolerate, that's when rent prices will finally start to drop as the big landlords need to generate more revenue to keep up the capital and operational expenses. And if rent prices drop far enough then it will no longer be profitable to spend all that capital snapping up starter homes, and eventually may even be placed back on the market.
connicpu commented on Geneva makes public transport temporarily free to combat pollution spike   reuters.com/sustainabilit... · Posted by u/kristjank
lupusreal · 11 days ago
Those taxes pay for road upkeep, as well as other state programs, but not carbon sequestration.
connicpu · 10 days ago
And I don't believe any states manage to cover the full cost of just their infrastructure and upkeep through use taxes (gas tax, registration, tolls). Non-drivers still end up subsidizing the remainder.
connicpu commented on Geneva makes public transport temporarily free to combat pollution spike   reuters.com/sustainabilit... · Posted by u/kristjank
aaronmdjones · 11 days ago
In the UK, VED is based on the vehicle's CO2 emissions per kilometre traveled under prescribed driving conditions. This means the registered keepers of EVs (and some hybrid ICE/EVs) pay nothing.

There are talks about scrapping this system as more and more of the country transitions to EVs, and taxing them by vehicle weight instead (the same way driving licences are classed). This would reverse the current status quo, with EV owners paying the most due to the greater weight of their vehicles.

I'm not sure I like that idea, but I also appreciate that as the revenue goes down under the current scheme, they may feel tempted to introduce something even worse to make up the deficit instead, like a tax per mile traveled.

connicpu · 11 days ago
Some states in the US with large numbers of EV drivers are already kinda doing this. I now have to pay a flat EV tax on my registration, although it's still less than I'd pay annually in gas tax if I drove an ICE car.
connicpu commented on Why tail-recursive functions are loops   kmicinski.com/functional-... · Posted by u/speckx
weitendorf · 12 days ago
What makes tail recursion "special" is that there exists a semantically equivalent mutable/iterative implementation to something expressed logically as immutable/recursive. [0]

Of course, this means that the same implementation could also be directly expressed logically in a way that is mutable/iterative.

func pow(uint base, uint n): n == 0 ? return 1 : return n * pow(base, n-1)

is just

func pow(uint base, uint n): uint res = 1; for(i=0; i<n; i++){ res *= n} return res

There is no real "advantage" to, or reason to "sell" anybody on tail call recursion if you are able to easily and clearly represent both implementations, IMO. It is just a compiler/runtime optimization, which might make your code more "elegant" at the cost of obfuscating how it actually runs + new footguns from the possibility that code you think should use TCO actually not (because not all immutable + recursive functions can use TCO, only certain kinds, and your runtime may not even implement TCO in all cases where it theoretically should).

As an aside, in C++ there is something very similar to TCO called copy-elision/return-value-optimization (RVO): [1]. As with TCO it is IMO not something "buy into" or sell yourself on, it is just an optimization you can leverage when structuring your code in a way similar to what the article calls "continuation passing style". And just like TCO, RVO is neat but IMO slightly dangerous because it relies on implicit compiler/runtime optimizations that can be accidentally disabled or made non-applicable as code changes: if someone wanders in and makes small semantic to changes to my code relying on RVO/TCO for performance they could silently break something important.

[0] EXCEPT in practice all implementation differences/optimizations introduce observable side effects that can otherwise impact program correctness or semantics. For example, a program could (perhaps implicitly) rely on the fact that it errors out due to stack overflow when recursing > X times, and so enabling TCO could cause the program to enter new/undesirable states; or a program could rely on a functin F making X floating point operations taking at least Y cycles in at least Z microseconds, and not function properly when F takes less than Z microseconds after enabling vectorization. This is Hyrum's Law [2].

[1] https://en.wikipedia.org/wiki/Copy_elision#Return_value_opti...

[2] https://www.hyrumslaw.com/

connicpu · 12 days ago
With Named RVO (I.e. you explicitly `return named_variable;`) copy-elision is actually guaranteed by the standard. I believe returning the return value of a function call is also guaranteed to not do a copy constructor. Anything else is compiler and optimization level dependent.
connicpu commented on Lithium compound can reverse Alzheimer’s in mice: study   hms.harvard.edu/news/coul... · Posted by u/highfrequency
modeless · 17 days ago
Lithium orotate is available over the counter. People could try it today.

> Since lithium has not yet been shown to be safe or effective in protecting against neurodegeneration in humans, Yankner emphasizes that people should not take lithium compounds on their own

I reject this kind of blind safetyism. A cursory search suggests that lithium orotate has been used for decades, and the article suggests that "profound effects" were seen at an "exquisitely low dose" which should be safe. They're going to need a much better explanation of why people shouldn't try it.

connicpu · 16 days ago
My spouse was prescribed lithium by doctors and it messed up her thyroid, it's not a drug to be taken lightly.
connicpu commented on FCC abandons efforts to make U.S. broadband fast and affordable   techdirt.com/2025/08/05/t... · Posted by u/CharlesW
msgodel · 18 days ago
Oh lol there wasn't even DSL, everyone wanted that. The options were dialup (over ISDN for a while which was one of the best options until that went away), geosynchronous satellite, or LTE if you're even near a tower.

That's why I'm so surprised they have fiber all of a sudden.

connicpu · 18 days ago
Starlink is now kind of a global baseline that ISPs have to compete against regardless of location. In rural areas it's very reasonable to expect 200-400mbps downloads and 20-40mbps uploads for $120/month. A bit pricey but it's a level of service that DSL and GEO sats can't even think about matching, so companies have to build cable, fiber, or 5G towers if they want to have a comparable offering.

u/connicpu

KarmaCake day1313October 9, 2017
About
[ my public key: https://keybase.io/connicpu; my proof: https://keybase.io/connicpu/sigs/3Hwqajy8vZqK6z_15FouKnzaSE_eKpQDKe2ZF9o-Jjo ]
View Original