[英]Good naming convention for scala “pimpers”
I don't like the fact that in scala its not obvious what some of my imports are doing - imports for implicits
so i'm trying to come up with good naming conventions for them so when i see in my import
statements something like: 我不喜欢这样的事实:在scala中我的一些导入操作并不明显 - 导入
implicits
所以我试图为它们提供良好的命名约定,所以当我在我的import
语句中看到类似于:
import com.mycomp.example.RectangleImplicits
or 要么
import com.mycomp.example.RectanglePimper
I know i cant remove that import because its being used for pimping
. 我知道我无法删除该导入,因为它被用于
pimping
。
My problem with the above names is that sometimes I actually do an adapter, in that case 我的上述名称的问题是,在这种情况下,有时我实际上做了一个适配器
import com.mycomp.example.RectangleAdapter
does not say anyting about the fact that its actually a pimper
however i don't want to name it RectangleAdapterPimp
because the name becomes to combersome... 没有说任何关于它实际上是一个
pimper
的事实,但是我不想将它命名为RectangleAdapterPimp
因为这个名字变得精简......
is there a golden bullet
naming convention for that? 有没有一个
golden bullet
命名约定?
thanks 谢谢
在std Scala库中,这些类以Rich
为前缀,如RichString
, RichInt
等......那么为什么不使用RichRectangleAdapter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.