let's say i have a function or method to get fib

func fib(n int){
  ...
  return fib(n-1) + fib(n-2)
}


now i want to add a counter to track how many times i have called to fib.

in python or jave i can easy use `decorator patten` to do it. 

but in go, you can not change fib since it is a function. if you define fib 
as a method, you cannot do it either since go did not have `Inherited`. you 
cannot call father class.

so golang did not support such thing? can we just reflect to do so?  






-- 
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/84685fb5-8657-4f57-94f1-4b444d722976%40googlegroups.com.

Reply via email to