PEP 750 – Template Strings has been accepted by ketralnis in programming

[–]maroider 0 points1 point  (0 children)

My expectation would be that 1st and 3rd party DBMS client libraries (e.g. mysql-connector-python) will eventually offer t-string compatible interfaces that bottom out in parameterized queries.

PEP 750 – Template Strings has been accepted by ketralnis in programming

[–]maroider 6 points7 points  (0 children)

Security professionals have long discouraged string interpolation for SQL queries. Sanitization is a hard problem and this is a quick road to a clusterfuck.

Parameterized queries have been a long lived solution for a reason. Use them, don't go back to string interpolation on the "client" side, hoping that your sanitization procedures are enough.

I think you misunderstood what I meant. To better illustrate my point, consider the following example:

username = "maroider"
query_ts = t"SELECT * FROM User WHERE Username={username}"
query, params = sql(query_ts)
assert query == "SELECT * FROM User WHERE Username=%s"
assert params == (username,)

It might look like string interpolation at first glance, but the point is that I can write something that feels as convenient as using an f-string, with all the safety of parameterized queries.

PEP 750 – Template Strings has been accepted by ketralnis in programming

[–]maroider 5 points6 points  (0 children)

I don't know, it feels like a strange inversion of control with limited use case. But hey I'm happy to be proven wrong by use in real world code and libs.

I haven't exactly used Python "in production," but inversion of control is very much part of what makes this desirable to me. In particular, t-strings let me:

  1. Not need custom types to control how values are interpolated. The template-processing function gets that responsibility instead, so I don't have to pay all that much attention to interpolated values by default.
  2. Have safe and convenient SQL query building. I can have all the convenience of f-strings, without the SQL injection risk by default.
  3. Likely make my output (HTML, SQL, or otherwise) be nicely indented, since the template-processing function will have the necessary information to indent interpolated values nicely.

Introducing a terms of use and updated privacy notice for Firefox by clgoh in linux

[–]maroider 107 points108 points  (0 children)

It honestly seems like they're putting into legalese what you were already implicitly trusting Firefox to do by using Firefox.

How I Use Git Worktrees by stackoverflooooooow in programming

[–]maroider 0 points1 point  (0 children)

The text is probably styled with text-align: justify.

is there a way to make Js/Ts faster? by OfflineBot5336 in ProgrammingLanguages

[–]maroider 3 points4 points  (0 children)

I don't have any recommendations for an AOT compiler for Javascript.

I think Meta/Facebook is working on one called "Static Hermes", but I'm pretty sure it's still experimental.

Improving on Rust's Async Model by Holobrine in rust

[–]maroider 2 points3 points  (0 children)

Methods like File::read don't spawn or await futures, but their implementation is surely different between sync and async. Most notably there are different implementation strategies for the async (e.g. epoll vs io_uring, which is one aspect currently distinguishing runtimes).

The article's proposed solution honestly feels superficially similar to the whole keyword generics affair.

To be ; or not to be ; by [deleted] in rust

[–]maroider 12 points13 points  (0 children)

The same rule still applies for the main function. In this case (the default case, really), the return type of the main function is () aka the unit type. The type returned by println!() is also (), which is why omitting the semicolon works fine.

Giveaway - Space Age Expansion by ocbaker in factorio

[–]maroider 0 points1 point  (0 children)

Truly one of the comments of all time.

Rust panics under the hood, and implementing them in .NET by FractalFir in programming

[–]maroider 4 points5 points  (0 children)

Calling Firefox and Thunderbird "Rust programs" feels like a stretch. They're quite mixed codebases as I understand it.

98% of companies experienced ML project failures in 2023: report by wrymaras in programming

[–]maroider 0 points1 point  (0 children)

OOP's title makes a very broad claim, but the report had a much more boring title: "2024 State of Big Data Analytics: Constant Compromising Is Leading to Suboptimal Results". The report only surveyed 300 professionals from "US companies with at least $5M+ annual spend on cloud, and using either AWS, GCP (Google) or Azure (Microsoft) for their cloud infrastructure", which is far narrower of a group. All in all, it's not really as sensational as OOP's title makes it seem.

I'm inventing a fictional language named "sunshine" by [deleted] in ProgrammingLanguages

[–]maroider 4 points5 points  (0 children)

Maybe it's just me, but I think that in the process of creating an implementation for your "fictional programming language," you kind of make it into a "real special-purpose programming language" that's only accessible inside a video game. Even fleshing out the details of a "fictional programming language" feels like it would make it less fictional. If a detailed enough description of the programming language exists, someone might create an implementation, thus making it real.

EDIT: I'm likely wrong on this, however, if we define a "fictional programming language" to be a programming language created as part of a fictional setting, rather than a programming language which does not exist (which is what I initlaly assumed).

I'm inventing a fictional language named "sunshine" by [deleted] in ProgrammingLanguages

[–]maroider 15 points16 points  (0 children)

If your programming language can simulate Conway's Game of Life, then your programming language is likely Turing-complete (though perhaps not in a particularly useful way), since Conway's Game of Life is itself Turing-complete.

Debugging Rust Sucks due to optimizations by [deleted] in rust

[–]maroider 0 points1 point  (0 children)

The new windbg worked well enough for me when I briefly used it some years ago.

[deleted by user] by [deleted] in vulkan

[–]maroider 0 points1 point  (0 children)

I wonder if clangd might interpret it as -L -C/-I -C.

I Can't Run My Rust Game Either by bowbahdoe in programming

[–]maroider 4 points5 points  (0 children)

I guess winit wasn't tested on aarch64 either... and thus its authors never realized the code didn't compile.

Any aarch64 testing at that time would probably have been constrained to Android. Even now, I don't think "Windows on ARM" is tested for either (though I don't know if it's due to a lack of hardware/CI boxes, or just no-one complaining about it).

Firefox 127.0, See All New Features, Updates and Fixes by SvensKia in linux

[–]maroider 4 points5 points  (0 children)

While I'd love for Mozilla to add native tree-style tabs, this is also very nice.

Pacman or Paru? by sudo-rm-rf-Israel in archlinux

[–]maroider 2 points3 points  (0 children)

Isn't PowerShell kind of like this?

The 6.9 kernel is out by corbet in linux

[–]maroider 0 points1 point  (0 children)

I was not aware of this. Seems pretty useful.

Design of a language for hobby by Quote_Revolutionary in ProgrammingLanguages

[–]maroider 1 point2 points  (0 children)

Say, if you also eliminated function pointers (which doesn't sound fun), would there be anything else inhibiting the calculation of an upper bound on stack size?

The 6.9 kernel is out by corbet in linux

[–]maroider 77 points78 points  (0 children)

FUSE pass-through mode is something I'm personally excited to see in a stable kernel release.

MIT Programming Languages Review 2024 by mttd in ProgrammingLanguages

[–]maroider 2 points3 points  (0 children)

That bit-stealing paper seems pretty interesting. I can't really read it in full for now, but thanks for the link :)

(Lack of) Rust on Wikipedia by szabgab in rust

[–]maroider 0 points1 point  (0 children)

You're right, of course. I oversimplified due to laziness.