Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

100% Positive

Analyzed from 299 words in the discussion.

Trending Topics

#function#arguments#colors#colored#languages#where#functions#different#don#color

Discussion (6 Comments)Read Original on HackerNews

legobmw99•20 minutes ago
I think this is a fine distinction to make, though it's worth noting that function arguments _can be_ colors as the author describes if the arguments have to come from a specific place, e.g. in languages where only `main` receives certain arguments relating to system functionality, or a capability framework where only the top-level function receives the capability token.
hoppp•about 1 hour ago
Generally when talking about colored functions, I think of an example like "async function" in javascript, those are definitely different colored.

I don't know about what would constitute as colored function in go as I generally don't consider arguments to be function colors.

Maybe methods in go would be different colored functions when they are defined on different struct types.

jerf•21 minutes ago
I don't think there's a way to color functions in Go. That's not terribly special, several languages have no colors in them.
kelseyfrog•24 minutes ago
A subset of function arguments are function colors because async/await is isomorphic to requiring and passing a `callback` arg around. It was named 'callback hell` because there wasn't an escape hatch and it affected every function in the callstack.

I'd venture to guess that there's a more abstract way of formalizing this in the sense that monad instances are required to be threaded through the callstack in particular cases(would love to see this spelled out formally) where IO and Cont(?) have this requirement but State like the author points out, does not.

jerf•18 minutes ago
I think this is a case where you want to avoid architecture astronautics and deal with languages as they are presented. Yes, in the end it's all continuation passing, or depending on the cut of your jib, it's all just assembler in the end, but meanwhile, down in the trenches, there are real, practical differences in color that change how you program in those languages, and that's the topic color addresses.
kibwen•34 minutes 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.