Hacker News·5 min read·hard

Function Arguments Are Not Function Colors

I
ingve
AI Summary

This technical article explores the concept of 'function colors' in programming, arguing that function arguments should not be conflated with the distinct 'async' function color problem. It proposes a criterion for identifying when a language feature creates a true functional dependency.

Why it matters

Understanding function coloring is essential for software architects designing scalable, asynchronous systems in modern programming languages.

Dive DeeperCreate a free account to unlock

Programming Page content Color As A Change Dependency Graph Shape Change Isolation Color Definition Advanced Topic: Partial Coloring In several debates online about function colors over the years, people have argued the apparently reasonable position that function arguments can constitute colors as well.

For instance, in Go, there is a context.Context value, which manages timeouts, cancellation, and a small amount of data that can be threaded through various functions. It is, by design, intended to be something passed through functions even if the receiver doesn't use it directly but only passes it along. Generally, once one function starts using a context, you should thread it along to all called functions that could conceivably have a use for it.

So, superficially, this appears to be a color. Once you have this particular argument in hand, you "have" to call all future functions of that type with that argument.

Continue reading on Headlinne

Create a free account to read the full article.

Read full article →
technologyscience

Get smarter about the news

Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.

Create free account

Already have an account? Sign in