On Mon, May 2, 2022, at 22:43, will....@gmail.com wrote: > - Functions: Compare the corresponding memory addresses. The time > complexity is constant.
How would this apply to inlined functions? supporting equality would essentially force the compiler to keep a the function in the output binary even if it's inlined everywhere it's called, just for comparisons. It would also complicate Here's another example: type worker struct { ... } func shutDown() { ... } func (w *worker) run(orders <-chan func()) { for f := range orders { if(f == shutDown) { log.Printf("got a shutdown command") w.Cleanup() } f() } } currently, Go programs run on a single computer. What if a Go runtime was built that ran Go programs across many computers? Or, put another way, what if a system architecture emerged where the instruction access time varied so drastically across CPU cores that it made sense to duplicate functions across cores' fast memory regions, so that the receive operation in the above example actually received a duplicate copy of a function? I will admit that closures with mutable data segments already complicate such an optimization, but function equality would thwart such an optimization altogether. David -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f566007f-aa47-4aaf-bc9e-a0fa9dab1e62%40www.fastmail.com.