Readit News logoReadit News
greener_grass commented on Improvements to OCaml code editing: the basics of a refactor engine   tarides.com/blog/2025-08-... · Posted by u/nukifw
panglesd · 10 days ago
Very cool!

Does it replace identical expressions in the same scope? Like:

    let tau = 3.14 +. 3.14
becomes

    let pi = 3.14
    let tau = pi +. pi
?

EDIT: Or even crazier with function:

    let _ = (x + 1) + (y + 1)
becomes

    let plus_one a = a + 1
    let _ = (plus_one x) + (plus_one y)

(I ask this just out of curiosity. Even the "simpler" version is very impressive!)

greener_grass · 10 days ago
LLM generated variable names would be nice!
greener_grass commented on AI coding agents are removing programming language barriers   railsatscale.com/2025-07-... · Posted by u/Bogdanp
behnamoh · a month ago
Counter point: AI makes mainstream languages (for which a lot of data exists in the training data) even more popular because those are the languages it knows best (ie, has the least rate of errors in) regardless of them being typed or not (in fact, many are dynamic, like Python, JS, Ruby).

The end result? Non-mainstream languages don't get much easier to get into because average Joe isn't already proficient in them to catch AI's bugs.

People often forget the bitter lesson of machine learning which plagues transformer models as well.

greener_grass · a month ago
More people who are not traditionally programmers are now writing code with AI assistance (great!) but this crowd seems unlikely to pick up Clojure, Haskell, OCaml etc... so I agree this is a development in favor of mainstream languages.
greener_grass commented on Blip: Peer-to-peer massive file sharing   blip.net/... · Posted by u/miles
greener_grass · a month ago
Is this AirDrop but cross-platform?
greener_grass commented on Losing language features: some stories about disjoint unions   graydon2.dreamwidth.org/3... · Posted by u/Bogdanp
Buttons840 · a month ago
If I write my happy_or_sad() callback and pass it to the Shape, it would be nice if I could get some exhaustiveness checking, but like the blog says, C++ and other popular languages intentionally left it out.
greener_grass · a month ago
The designer of the type must manually ensure exhaustive checking but then consumers will be forced to do exhaustive matching.

It's not that bad in practice.

greener_grass commented on I'm switching to Python and actually liking it   cesarsotovalero.net/blog/... · Posted by u/cesarsotovalero
t43562 · a month ago
IMO "pythonic" is mostly about using the features the language has rather than trying to treat it as if it was Java or C++.

Having said that, in reviews you do get lazy comments like "not pythonic" or "not best practises" which often boil down to the reviewer just not liking something and being too much of an *** to say why. This is supposed to be a total shutdown that you cannot argue with and it's the kind of thing that might put you off the term "pythonic" for life.

"There should be one-- and preferably only one --obvious way to do it."

This is probably the core thing you might have issue with but I think its not really about conforming in how you write your own code but about the thing you make being easy for others to use.

greener_grass · a month ago
I love this sentiment:

> There should be one-- and preferably only one --obvious way to do it.

But I often don't think the Pythonic way is a very good way to do it. And this leaves you a bit stuck!

greener_grass commented on Switching Pip to Uv in a Dockerized Flask / Django App   nickjanetakis.com/blog/sw... · Posted by u/tosh
jerrygenser · 2 months ago
You do not write requirements by hand. You write requirements.in and uv pip-compile to requirements.txt
greener_grass · 2 months ago
Does `pip-compile` solve deps and transitive deps?

I thought it only locks down hashes?

greener_grass commented on Switching Pip to Uv in a Dockerized Flask / Django App   nickjanetakis.com/blog/sw... · Posted by u/tosh
cpburns2009 · 2 months ago
I find it's clearer to store all pinned dependencies in requirements.txt using pip-compile (or pip freeze). There's no finagling in trying to determine which file contains the dependency snapshot for installing an application. High level dependencies can be defined in requirements.in or pyproject.toml.
greener_grass · 2 months ago
If you write out `requirements.txt` by hand, do you also need to resolve deps and transitive deps by hand?

This is what pushed me to use Poetry.

greener_grass commented on Of Course ML Has Monads (2011)   existentialtype.wordpress... · Posted by u/Bogdanp
greener_grass · 2 months ago
Does ML have do notation?

In ML do you need to write `List.map` where in Haskell you can write `map` and it infers the type?

greener_grass commented on Switching Pip to Uv in a Dockerized Flask / Django App   nickjanetakis.com/blog/sw... · Posted by u/tosh
incognito124 · 2 months ago
It's only a mess because not everyone has adopted uv yet (IMO)
greener_grass · 2 months ago
UV looks very promising but I can assure you, if everyone adopted it tomorrow we would see a long tail of scenarios that UV does not work well for.
greener_grass commented on Switching Pip to Uv in a Dockerized Flask / Django App   nickjanetakis.com/blog/sw... · Posted by u/tosh
ericfrederich · 2 months ago
I am totally against Python tooling being written in a language other than Python. I get that C extensions exist and for the most part Python is synonymous with CPython.

I think 2 languages are enough, we don't need a 3rd one that nobody asked for.

I have nothing against Rust. If you want a new tool, go for it. If you want a re-write of an existing tool, go for it. I'm against it creeping into an existing eco-system for no reason.

A popular Python package called Pendulum went over 7 months without support for 3.13. I have to imagine this is because nobody in the Python community knew enough Rust to fix it. Had the native portion of Pendulum been written in C I would have fixed it myself.

https://github.com/python-pendulum/pendulum/issues/844

In my ideal world if someone wanted fast datetimes written in Rust (or any other language other than C) they'd write a proper library suitable for any language to consume over FFI.

So far this Rust stuff has left a bad taste in my mouth and I don't blame the Linux community for being resistant.

greener_grass · 2 months ago
Rust offers a feature-set that neither Python nor C has. If Rust is the right tool for the job, I would rather the code be written in Rust. Support has more to do with incentive structures than implementation language.

u/greener_grass

KarmaCake day258August 5, 2024View Original