al4s

joined 6 months ago
[–] al4s@feddit.org 21 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

AI has been in phones for ages. What's new is the following:

  • It has become fashionable to market things as AI
  • New phones can run more AI locally now, in the past almost everything had to be sent to the cloud first
  • LLMs enable much better answers if you ask a voice assistant a question, or if you want a summary of anything

If that warrants branding everything as AI I'll leave up to you

[–] al4s@feddit.org 5 points 3 weeks ago (6 children)

Dumb question, why would anyone put electrical outlets in the ceiling?

[–] al4s@feddit.org 2 points 3 months ago

Because you don't control third party libraries

[–] al4s@feddit.org 2 points 3 months ago (2 children)

A scope groups the initialization visually together, while adding the let app = app; feels like it just adds clutter - I'd probably just leave it mut in that case.

[–] al4s@feddit.org 2 points 3 months ago (2 children)

You can have setters that set private fields, there are also sometimes structs with mixed private and public fields

[–] al4s@feddit.org 6 points 3 months ago (4 children)

Yeah if you have the second option, use it, but if the struct has private fields it won't work.

[–] al4s@feddit.org 12 points 3 months ago (10 children)

If you're ever forced to do something the second way, you can also wrap it in braces, that way you end up with an immutable value again:

let app = {
  let mut app = ...
  ...
  app
};
[–] al4s@feddit.org 22 points 3 months ago

Definitely the second one.

  1. It avoids Mut
  2. It makes clear that the initialization is over at the end of of the statement. The first option invites people to change some more properties hundreds of lines down where you won't see them.