Remix.run Logo
kibwen 3 days ago

"Function colors" are just effect systems, which are not a new concept while also being extremely useful and super nifty. I hope someday we can stop wringing our hands in a panic over "colored functions" just because some ancient version of Javascript had a frustrating implementation of one specific effect. It reminds me of how ages ago certain people acquired an instinctual aversion to static typing attributable entirely to ancient versions of Java and its attendant verbosity and relative anemia.

dnautics 2 days ago | parent [-]

No. Function colors (see criterion 4 in the original article) deal with the idea of "how much of a pain in the ass is it to deal with" which is not really a concept that is a PL theory concept.

kibwen 2 days ago | parent [-]

The article only lists 3 criteria, not 4, but if you're referring to the final one:

"3. The change may require a change to all functions in the stack."

That's a potential feature of effect systems. An effect generally indicates a restriction of some kind, and depending on your desired semantics it could be totally counterproductive to paper over it with abstraction. And there's a variety of different knobs to twist that aren't necessarily the same semantics that any given implementation of async uses. To use Rust as an example, its `const `effect imposes restrictions down the callstack, and cannot be discharged (const functions can only call other const functions, period), while its `unsafe` effect imposes restrictions up the call stack and can be discharged (by a non-unsafe function that uses an `unsafe` block internally.

mitxela 2 days ago | parent | next [-]

The *original* article: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...

Criterion 4 is: Red functions are more painful to call.

They are correct - this isn't a PL theory concept.

kibwen 2 days ago | parent [-]

"More painful" is just being used to mean "explicit", and being explicit rather than implicit about intention is absolutely a PL theory concept, e.g. the whole difference between static and dynamic typing, or strong typing and weak typing.

dnautics 2 days ago | parent [-]

"Maybe it’s really verbose, or maybe you can’t do it inside certain kinds of statements. Maybe you can only call them on line numbers that are prime."

Nope. If it's explicit but maybe like a single keyword away that's not "painful", I would guess.

clickety_clack 2 days ago | parent | prev [-]

I don’t know, “the change is a major pain in the ass” might be a good addition as criterion 4.