News for hackers. Stuff that matters.
Re:Why Co–Star Uses Haskell by gen220 on Friday November 05, 2021 @01:44PM (#29122477)
> do any linters complain about input modification or out-of-scope references?

I know Instagram was experimenting with something similar to this a couple years ago (“Python strict modules”).

It might be possible to implement function purity with a decorator. (Kind of like declaring something “safe” in Rust).

Definitely agree that Python is becoming more amenable to functional style programming over time. And it’s great!

Re:Why Co–Star Uses Haskell by ianandrich on Friday November 05, 2021 @05:11PM (#29124790)
> It might be possible to implement function purity with a decorator. (Kind of like declaring something “safe” in Rust).

Two parts to this. 1: Does it mutate variables. 2. Does the code have side effects.

1: def no_mut(func): @functools.wraps def new_func(args, *kwargs): new_args = tuple(copy.deepcopy(arg) for arg in args) new_kwargs = {k, copy.deepcopy(v) for k, v in *kwargs return func(new_args, *new_kwargs) return new_func

For the second point, gevent seemed to have a trick to identify side effecting code.