Hacker Newsnew | past | comments | ask | show | jobs | submit | LogicHound's commentslogin

`var` doesn't have weird scoping issues, it just different than other languages. `var` is function scoped, thus all var declarations are hoisted to the top of the function during execution.

This is why the single var pattern used to be recommended.


> Pure efficiency in locomotion is a terrible measure, is a person on a bicycle more efficient traversing a forest?

Quite possibly. I would imagine it depends on the forest. I've been in forested areas on the mountain bike and you can cycle through these areas fine.

> It's the classic physics issue - you are ignoring air resistance, but in this case you are ignoring everything other than a perfectly paved road.

Rolling resistance is mainly down to the types of tyres used, how wide they are and how much they are inflated. Surface doesn't make that much of a difference IMO unless it is on a really lose surface e.g. loose gravel, mud or ice.

The biggest improvements to cycling efficiency is usually either being in a recumbent bicycle (less air resistance as you are led down) or by being in a more more Aero position with lycra on. But air resistance only becomes a big thing past 20mph or if you are wearing clothing that is really baggy.

Bicycles are the most efficient forms of transport in energy per mile. They are often the fastest in built up areas as well.


"Bicycles are the most efficient forms of transport in energy per mile. They are often the fastest in built up areas as well."

I don't disagree, but if this is the purpose of this graphic, why not just specifically measure different forms of transport in energy per mile?

This article is putting a metric of efficiency, while ignoring the reasons why things like a dog may have less efficent locomotion over perfectly flat terrain, because there are very few natural landmarks that have perfectly flat terrain.

I'd love to see a deeper comparison, how does efficiency of locomotion compare between animals within different types of environments, obstacles, etc. Otherwise this is a graphic that was used to make a point about cycling using an abstract measure rather than actual research.


They updated the graphic to include HPV style vehicles that are more aerodynamic than bicycles (usually just a bicycle with an aero-shell). I am not sure why this has come up now because I have an old bicycle book my Grandmother bought for me back in the late 90s that discusses these vehicles and it was known then they were more efficient.

> This article is putting a metric of efficiency, while ignoring the reasons why things like a dog may have less efficent locomotion over perfectly flat terrain, because there are very few natural landmarks that have perfectly flat terrain.

You can't control for this stuff and measure it really.

> I'd love to see a deeper comparison, how does efficiency of locomotion compare between animals within different types of environments, obstacles, etc.

Again this is difficult to control for. Other than particular areas where bicycle won't work (and there are very few places where that would apply), the bicycle is still likely to win out. Even if you have to get off occasionally to navigate over/under/around an obstacle you get all the benefits of efficiency for the majority of the time.


my intuition is that over smoothish, but hilly terrain, mountain bikes fare very well, too, since you get to go downhill for free. once you end up in a talus field, I think it becomes clear that "efficiency" is gone for basically any creature on land.


> But air resistance only becomes a big thing past 20mph or if you are wearing clothing that is really baggy.

Can confirm, am 105kg 51-year-old and can get pretty close to 20mph on the flat on my elderly Commençal Uptown. I suspect someone that rode a greater distance per day and weighed about 20kg less would be able to hit 20mph for far longer periods of time.

The further point is that my even more elderly 30-year-old Range Rover can get something like 3mpg better fuel economy on a long run at 50mph than at 70mph. It's genuinely worth getting up at around 4am to drive on deserted roads at 40-50mph to get the back of the journey broken before you start to have to care about keeping up with traffic - just me and the lorries at that time - to get an easy 50-60 more miles out of a tank.

Bicycles are incredibly mechanically efficient because it's basically three sets of taper roller bearings and a chain drive, and chains are insanely efficient. Shaft drive and belt drive sound good, but belts have a lot of friction and shafts require a couple of right-angle gearboxes which are notoriously inefficent. You can make really efficient hypoid gears (that's what's in vehicle differentials, to turn the fore-and-aft propshaft's rotation through 90 degrees, and they're quiet, efficient, and immensely strong) but they require complex cutting curves.

I think that people complaining about the "inefficiency" of bikes are confusing efficiency with effectiveness. A bike would be very efficient at turning power from your legs into motion, but it would not be very effective at transporting two adults, 200kg of tools, and a 3.5 tonne trailer for a couple of hundred miles on road and then a few more up a steep muddy rocky mountain path.

The simple fact that bikes haven't really changed in about a century and a half should tell you how right they got it, straight out the gate. Everything else has been evolution. Take a look at the picture of the 1885 Rover Safety Bicycle on Wikipedia, and tell me you wouldn't quite happily daily that! Okay, you'd be a Hipster Fixie Twat but it would be just right for bimbling round the Finniestoun coffee shops with your ridiculous haircut and Macbook trying to find backers for your AI-powered Cat Food Over IP startup. Me, I'd throw a set of disc brakes and a 5-speed derailleur on, and ride it everywhere.

I genuinely like that frame, actually. I may have to invest in a tube bender.

https://en.wikipedia.org/wiki/Safety_bicycle#/media/File:Rov...


> The chip is expected to power future Microsoft Surface products scheduled for release in 2026.

It looks like it is intended to run Windows Arm.


I use it to generate me example code e.g. how do I do <thing> in <programming language> using <library>.

I've also had it suggest solutions e.g. "This C++/OpenGL code doesn't run in wayland can you suggest some solutions".

Other stuff like generating tests is hit and miss.


Much like PHP, you can actually get stuff done unlike a lot of other programming languages.


Oh? Which “lot of” other programming languages can’t you “actually get stuff done” in? Are you sure the problem lies with the programming language?


It’s an exaggeration perhaps but I get the sentiment. FP is elegant and beautiful and everything, but it can lead you to spend all day puzzling out the right abstractions for some data transformation that takes 5 minutes with a dumb for loop in Go.


I find there are some environments where you have a positive feedback loop while working in them. PHP is one of them, Go is another at least for me.

I find many of languages I am constantly fighting with dependency managers, upgrades and all sorts of other things.


I can't stand modern C#. They've bung in a bunch of new keywords and features that are of dubious benefit every release.


I'm interested what are those new keywords and features that are of dubious benefit?


There is a huge amount of syntactic sugar that has been added over the years that doesn't do whole lot IMO. It is often imported from other languages (usually JavaScript and/or Python).

e.g. Just a very simple example to illustrate the point

    if (customer != null)
    {
        customer.Order = GetCurrentOrder();
    }
vs

    if (customer is not null)
    {
        customer.Order = GetCurrentOrder();
    }
Is there really any benefit in adding "is/is not"? I would argue no. So I categorise that as being of "dubious benefit" and there are many similar small features, keywords etc. that get added each release where they might save a few lines of code somewhere but I've never seem them used that often.


In your sample there really is no benefit to using the "is" operator over just checking for null (assuming you haven't overloaded the "!=" operator). However, the "is" operator is a lot more powerful, you can match an expression against a pattern with it. Would you say that these samples show no benefit to using the "is" operator?

if (obj is string s) { ... }

if (date is { Month: 10, Day: <=7, DayOfWeek: DayOfWeek.Friday }) { ... }

https://learn.microsoft.com/en-us/dotnet/csharp/language-ref... https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...


> In your sample there really is no benefit to using the "is" operator over just checking for null

Microsoft give the same example though. I understand what hes saying, theres conceptual overlap between is and ==. Many ways to do the same thing.

Why couldnt it just be...

if (obj == string s) { ... }


The issue is that I dislike the overall mentality of just adding a bunch of language features. Things just seem to be dumped in each release and I think to myself "When I am going to use that?".

> Would you say that these samples show no benefit to using the "is" operator?

I didn't say no benefit. I said dubious benefit.

I didn't really want to get into discussing specific operators, but lets just use your date example:

   if (date is { Month: 10, Day: <=7, DayOfWeek: DayOfWeek.Friday }) { ... }
This following would do the same thing before the is operator:

    static bool IsFirstFridayOfOctober(DateTime date)
    {
        return date.Month == 10
            && date.Day <= 7
            && date.DayOfWeek == DayOfWeek.Friday;
    }
And then:

    if IsFirstFridayOfOctober(date) {
       ...
    }
I understand it is more verbose. But do we really need a new operator for this? I was getting on fine without it.

Each release there seems to be more of these language features and half the time I have a hard time remembering that they even exist.

Each time I meet with other .NET developers either virtually or in Person they all seem to be salivating over this stuff and I feel like I've walked in on some sort of cult meeting.


I agree that they should not add new stuff lightly, but the "is" operator actually should be looked together with switch expression in the context of pattern matching. How else could you enable powerful and succint pattern matching in c#?


Arguments about whether the is and switch operators should exist is missing the forest for the trees. I am sure there are circumstances where it very useful.

It isn't any one language feature it is the mentality of both the developer community and Microsoft.

> I agree that they should not add new stuff lightly

It seems though kinda do though. I am not the first person to complain that they add syntactic sugar that doesn't really benefit anything.

e.g. https://devclass.com/2024/04/26/new-c-12-feature-proves-cont...

I have a raft of other complaints outside of language features. Some of these are to do with the community itself which only recognise something existing when Microsoft has officially blessed it, it is like everyone has received the official permission to talk about a feature. Hot Reload was disabled in .NET 6 IIRC for dubious reasons.


I have to admit this really does seem like beautiful syntactic sugar despite me not being a fan of accumulating keywords in languages. Your example of writing a function instead of a neat little lambda is clunkier to quickly scan for correctness.


In Python '==' and 'is' are not the same thing. '==' checks for equality, 'is' for identity.


I am aware. I probably should have said "inspired".


> It's funny how functional programming is slowly becoming the best practice for modern code (pure functions, no side-effects),

I once mentioned both these concepts to a room of C# developers. Two of them were senior to me and it was a blank expression from pretty much everyone.

> yet functional programming languages are still considered fringe tech for some reason.

You can use the same concepts in non-functional programming languages without having to buy into all the other gumpf around functional programming languages. Also other programming languages have imported functional concepts either into the language itself or into the standard libraries.

Past that. It is very rare to be able to get a job using them. The number of F# jobs I've seen advertised over the last decade, I could count on one hand.


It is easy to miss a subscription for something on a bill when it is less than £30. I had a match.com subscription I had forgotten about for about 7 years.

That business model is what a lot of tech companies actually bank on that why they require a credit card on a free sign up.


It's only easy to miss if you're irresponsible. Having enough (some would say, "more than enough") money makes being irresponsible less painful.


The way you are using irresponsible is perverse. e.g. Being Irresponsible in this context would be remortgaging your house, while unemployed and using all the money to buy gadgets.

Forgetting that you have a small amount deducted for a service you are no longer using, isn't. It is minor oversight.

The way that language is abused by people when it comes to these sorts of subjects is bordering on semantic manipulation. Which in itself is a form of deceit.


It's a difference of degree, not kind. 30 bucks thrown into a corporate black hole instead of a handful of meals, or gas for a day of driving delivery, or medicine. An hour or two or three of a low-income earner's productivity, every month, possibly for years, because... you didn't care to spend 5 minutes looking at your bank or credit card statement? Come on.

But, of course, no one can tell off the comfortable class. It's "perverse" and "abuse" and "deceit" and "manipulation". eyeroll

If the subject were as minor as you say, you wouldn't be trotting out that kind of characterization. I hit a nerve.


> I think what you want is for software developers not to write bloated code, instead of computers not getting faster. The bloated code is a result of undisciplined programming and not paying attention to users' devices.

I am so fed up of hearing this. I would love to optimise my code, but management will always prioritise features over optimisations because that is what drives sales. This happens at almost every company I've worked at.

Also more often than not, I have a huge problem even getting stuff working and having to wrangle co-workers who I have to suffer with that cannot do basic jobs, do not write test and in some cases I've found don't even run the code before submitting PRs. That code then get merged because "it looks good" when there is obvious problems that I can spot in some cases from literally the other side of the room.


I am a die-hard Linux guy and I have to use Windows for certain things. One of those is multiplayer games. I am never buying a Mac. I've owned 4 macs over the last 20 years and I've regretted every purchase.


I've only ever used windows. Recently got a mac mini so I could compile for iOS. I'm debating embracing the entire Apple ecosystem given I use iPhone. Not a huge fan of iCloud's pricing though. Curious what issues you ran into with your macs/Apple experience?


I had the following problems. Note my hardware was ageing at the time and was about 5 years old. I know a quality apple specialist that did the work.

- Glue'd in batteries on Laptops. I had a Mac Pro with a glue'd in battery. I could have done it myself, however I ended up opting to get someone who knows what they are doing to replace it. Labour and battery replacement cost me about £250.

- Official charger made the power lines toast. Another £250 to get it repaired.

- iOS Safari browser sometimes stops videos / audio when the screen locks or you switch apps. It is really annoying. Doesn't happen on Graphene OS or Android.

- iCloud is kinda required if you use an iPhone even though I don't use it for backups.

- Upgrades just aren't possible. Every single on of my laptops I have, I have upgraded ram, disk and even processor on some of the older models I have. I changed an intel Mac Mini drive to an SSD, it was a fiddly to say the least. On other SFF machines it is often a 5 minute job.

- MacOS is kinda just weird. While it is a Unix, it does everything it can to hide it. As someone that used both Linux/BSD. MacOS feels like running a weird Linux distro. Brew was kinda weird after coming from Linux world. I would have just preferred to run Linux.

- The online account stuff with Apple is somehow worse than Microsoft.

These days I buy refurb Business Laptop from Dell or Lenovo. Literally 10% of the price, Linux almost always works and if breaks, I can buy another one cheap for the same price as repairing an Apple machine. I get it, they are not as nice but for me they work fine and are much cheaper.


For me it was the keyboard shortcuts and mouse behavior differences. That plus the homebrew weirdness trying to emulate Linux package management. I decided to just use Linux.

Ultimately, Linux is a development environment for Linux, and by extension the most developer friendly OS imo.


I’ve gotten used to the mouse behavior and keyboard shortcuts.

One thing that drives me nuts about Linux is that application support generally isn’t as good as Mac. For example, there is no Claude Desktop app for Linux nor an Apple Music desktop app. If you need those, you’re using somebody’s hacked together project that half works, a web version with limited features, or paying for a third party app.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: