cosmos/cosmos-sdk

Rename Msg.Name() to Msg.MsgType() and Msg.Type() to Msg.MsgRoute()

sunnya97 opened this issue ยท 7 comments

Can we rename the method .Name() on the Msg interface? The field Name is something that many modules may want to use and it can be hard to come up with a good synonym for it. i.e. this broke my nameservice module

I propose changing the Name method to Type and the Type method to Route

I proposer Name -> MsgType and Type -> MsgRoute

I proposer Name -> MsgType and Type -> MsgRoute

Three thumbs up, seems past the threshold of "proposal-accepted" - sounds good to me!

Msg.MsgType() and Msg.MsgRoute() seem redundant to me. Why not just Msg.Type() and Msg.Route() ?

I agree with @fedekunze. I don't think we should prepend msg either. I think it is reasonable to reserve Type and Route as methods on message types. I highly doubt that it will inconvenience that many people, whereas MsgType and MsgRoute does seem confusing.

If we had .Name() it would make the struct unable to contain Name field. Since Name is likely to be used in various situations, it makes sense to rename it to MsgName(). However we already have type keyword in golang and the name Route will not be used widely like as Name, I think we can assume both will not be used in the structs, so it is safe to rename it to Type() and Route().

I'm fine with .Type() and .Route() too, either option is better that what we have at the moment.