🇨🇦 tunetardis

  • 0 Posts
  • 132 Comments
Joined 2 years ago
cake
Cake day: June 11th, 2023

help-circle






  • Thanks, it makes me feel relieved to hear I’m not the only one finding it a little overwhelming! Previously, I had been using chatgpt and the like where I would be hunting for the answer to a particularly esoteric programming question. I’ve had a fair amount of success with that, though occasionally I would catch it in the act of contradicting itself, so I’ve learned you have to follow up on it a bit.


  • I turned on copilot in VSCode for the first time this week. The results so far have been less than stellar. It’s batting about .100 in terms of completing code the way I intended. Now, people tell me it needs to learn your ways, so I’m going to give it a chance. But one thing it has done is replaced the normal auto-completion which showed you what sort of arguments a function takes with something that is sometimes dead wrong. Like the code will not even compile with the suggested args.

    It also has a knack for making me forget what I was trying to do. It will show me something like the left side picture with a nice rail stretching off into the distance when I had intended it to turn, and then I can’t remember whether I wanted to go left or right? I guess it’s just something you need to adjust to. Like you need to have a thought fairly firmly in your mind before you begin typing so that you can react to the AI code in a reasonable way? It may occasionally be better than what you have it mind, but you need to keep the original idea in your head for comparison purposes. I’m not good at that yet.





  • That’s the point, when programming with immutable structures you always pass the mutability onto the enclosing structure.

    I guess the point I was trying to make here was if the data type is already mutable, there is no point in sticking it in a list just so you can replace a reference with an identifier. You’re just adding an extra level of indirection. But sure yeah, if the type is inherently immutable, you have to do something.

    A list is an antipattern here IMO. Just wrap it in some dedicated object (see e.g. Java’s StringBuilder).

    Interesting. I’m not aware of anything like StringBuilder in the standard library for either Python or JavaScript. Looks like it wraps a list of characters and tries to behave as string-like as possible? You could presumably write your own class like that or download an implementation from someplace.

    I guess in most cases in my own code, where I need a mutable string is usually as part of a larger data structure which is the thing that gets passed around by reference, so it’s easy enough to replace a field within that.

    For building up a string, I would tend to use an io.StringIO in Python with file-writing calls, but those aren’t meant for sharing. What you don’t want to do is use the += operator a lot on strings. That gets expensive unless strings are mutable (like they are in say C++'s std::string).




  • I think if there’s a silver lining to the 100% tariffs on Chinese EVs in North America, it is that it will hasten adoption of ebikes, which imo solve more problems than EVs in any case.

    His point that ebikes replace cars—not conventional bikes—tracks for me. Mine has basically replaced our second car and I use it, as he indicated most people do, for commutes and short errands.

    His point that an ebike has an energy footprint comparable to a 4000 mpg ICEV is an incredible metric. I wonder where he pulled that from? I know that my ebike battery has 1/150th the capacity of what goes into a Tesla. Granted, I wouldn’t expect a comparable range so there’s a bit of apples to oranges there. But if you then work in that EVs are already much more energy efficient than ICEVs, I guess you could arrive at a number like 4000.

    Whatever the case, my experience with ebikes is that they are pretty close to free transportation in terms of operating costs. There may be a few unexpected expenses beyond the initial sticker cost of the bike in terms of accessories (particularly high quality locks) and some winter gear if you’re in a colder climate, but those are one-time purchases for the most part.


  • I had a chat with my American relatives at one point which began with me asking why it seems medical malpractice suits have such soaring high settlements compared to where I am in Canada? They explained it to me like this. Say a botched procedure leaves you requiring constant medical treatments for the rest of your life. You have to sue for any treatments you would otherwise have to pay out of pocket. Where you have a public healthcare system, the state would cover that. You may still sue for loss of employment if you are no longer able to work, say, but settlements tend to be orders of magnitude higher because of those additional costs. Unfortunately, this leads to a proliferation of bottom-feeding personal injury lawyers who try to get you to litigate and overstate your injuries to get bigger settlements.