samus7070

joined 2 years ago
MODERATOR OF
[–] [email protected] 3 points 6 months ago (3 children)

I think the responder means that duplicate code is usually easy to refactor into single methods. Typically I see copy pasted code that is changed just a little bit. However much of a duplicated function can be broken into smaller functions and the redundant code removed in favor of calling into the functions. Often what is left then becomes easier to reason about and refactor accordingly. I love the PRs that I make which delete more code than I add but still manage to add functionality. It doesn’t happen often but it’s fun when it does.

[–] [email protected] 15 points 6 months ago (1 children)

If your primary exposure to programming is only typescript or JavaScript maybe you shouldn’t be jumping straight into something like rust. JS is a high level language and rust is aimed at the lower levels where things can’t be as automatic. There are many languages out there like C#, Kotlin and Swift that will help you get used to the idea of strong types and immutability.

[–] [email protected] 2 points 9 months ago

The reflog is your friend in situations like that.

[–] [email protected] 1 points 9 months ago

I think there might be something to do that in Foundation. You would have to cast to an NSString to access it though. I might be mistaken and there’s only a title case method. Sentence case is easy minus the not converting proper names to lower case problem.

[–] [email protected] 8 points 11 months ago (1 children)

I would argue that Biden can say and do plenty of crazy things as long as he never goes full Trump.

[–] [email protected] 9 points 1 year ago (1 children)

It was originally meant as a better JavaScript and it was. It failed when none of the other browsers expressed interest in supporting it. It languished for a while and then was taken up by the Flutter team. At the time Flutter took it up it was somewhere around the level of Java 8 in features but not quite on par. Since then it’s seen some massive improvements to the type system and language. It’s completely null sound, not just null safe like Kotlin. It recently got records/tuples and one of the more capable pattern matching syntaxes I’ve ever seen in a functional imperative hybrid language. The next stable version of dart will introduce a compiler macro system that is very promising. The syntax isn’t always the prettiest due to it trying to not totally break old code. I do think that it offers a wide range of modern language features that competes heavily with Swift and Kotlin in the mobile space.

[–] [email protected] 11 points 1 year ago

The only things JSON has over xml is that it’s easier to write a parser for it and the format is less verbose and less complicated. There are extensions to JSON that can add features that xml has and the JSON spec doesn’t have. Overall the xml spec is bigger and has more features but that also makes it overkill for many of the cases that it would be used in.

[–] [email protected] 16 points 1 year ago

Claims top 5 and offers zero evidence and very little content beyond what an LLM might write.

[–] [email protected] 1 points 1 year ago

Because ChatGPT thought that was a pro?

 

It’s another virtual conference year with an optional and free in person opening day. https://developer.apple.com/wwdc24/

[–] [email protected] 2 points 1 year ago

He’s not going to jail yet. Those are other criminal cases.

[–] [email protected] 7 points 1 year ago

They tried like hell to keep it off of the ballot in Ohio because they were afraid of what did happen. I can’t say if all of the dirty politics influenced people who were unsure how to vote in the opposite direction the GOP intended. Statistically speaking the final vote wasn’t even close. That is what they fear.

[–] [email protected] 5 points 1 year ago (2 children)

Or it is just corporate greed. Samsung would love to position something that is just okay into a premium price tier and not have to pay Intel. Sure they’re going to pay Qualcomm instead but you can bet that Qualcomm is giving some great introductory prices to their early partners.

 

I did something like this for analytics on the company app. It needs to record analytics to multiple providers for which a fan out pattern was a good fit. There's a single entry point to log an event. Any number of loggers then pick up that event and send it out to the provider. It has worked well and is even used for functionality inside of the app that should happen after a certain set of events occur in the app. For instance it prompts the user to rate and review the app after the user has performed a conversion event. A similar set of events will trigger the app to prompt the user to allow push notifications.

 

It's a nice explanation and exploration of how state in SwiftUI works.

 

Apple introduced the new Observation framework powered by the macro feature of the Swift language. The new Observation framework, in combination with the Swift Concurrency features, allows us to replace the Combine framework that looks deprecated by Apple. This week, we will learn how to use the Observation framework to handle data flow in our apps.

I'm not sure that I buy the idea that Combine is deprecated. This does help reduce one use for it where it while increasing performance.

1
Swift Data by Example (www.hackingwithswift.com)
 

SwiftData by Example is the world's largest collection of SwiftData examples, tips, and techniques to help you build apps, solve problems, and understand how SwiftData really works.

 

async/await in Swift was introduced with iOS 15, and I would guess that at this point you probably already know how to use it. But have you ever wondered how async/await works internally? Or maybe why it looks and behaves the way it does, or even why was it even introduced in the first place?

1
@Model for CoreData (www.alwaysrightinstitute.com)
 

I've never been a big Core Data fan since it has cost me many days of my life debugging odd issues. To be fair, the issues weren't caused by Core Data. It was all of the foot-guns it left around that the junior developers on the team were more than happy to pick up and play with. This does look like an interesting use of macros though and is certainly a good example of how to craft more complex macros.

 

This is one feature that I missed from some other languages like Kotlin. It isn’t super useful for ifs but a switch with a lot of cases? Bring it on.

1
RaspberryPi 5 Review (www.tomshardware.com)
 

It looks like a big improvement over the 4 but sadly needs active cooling or it throttles under load quickly. It has a new form factor which requires a new case too. Still there are a lot of great additions that make it a good upgrade.

 

cross-posted from: https://programming.dev/post/3558087

Type parameter packs and value parameter packs allow you to write a generic function that accepts an arbitrary number of arguments with distinct types. As a result of SE-393, SE-398, and SE-399, you can use this new feature from Swift 5.9.

 

Type parameter packs and value parameter packs allow you to write a generic function that accepts an arbitrary number of arguments with distinct types. As a result of SE-393, SE-398, and SE-399, you can use this new feature from Swift 5.9.

 

I found this link via SwiftUI Weekly #161

Actors is the new Swift language feature, making your types thread-safe. This week, we will learn how to use actors and their benefits over locks. We will also discuss actor reentrancy, the main confusing point of using actors.

In the previous post, we modeled a Store type, allowing us to implement state management predictably.

view more: next ›