You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
bradfitz
changed the title
Proposal Create method on defined struct using reflection
Proposal: Create method on defined struct using reflection
May 1, 2017
As a general rule, the reflect package should provide exactly the capabilities of the language. In the language you can not define a method on an existing struct, so reflect shouldn't let you do it either.
Also, if you could define a struct in one package and add methods in another the general handling of interface conversion would be inconsistent, depending on whether the methods had been added or not.
It would be good create functions using reflection inside the struct already defined.
Like this:
The text was updated successfully, but these errors were encountered: