我在Scala Saddle中找到了以下定義,只是想確保我正確理解它。有一個對象界定暴露了一些HDF5 I/O功能的幀類型,以便writeHdfFile
功能變爲可用於任何幀的隱函數:新和大括號(沒有類型創建)的含義是什麼?
object H5Implicits {
/**
* Provides enrichment on Frame object for writing to an HDF5 file.
*/
implicit def frame2H5Writer[RX: ST: ORD, CX: ST: ORD, T: ST](frame: Frame[RX, CX, T]) = new {
/**
* Write a frame in HDF5 format to a file at the path provided
*
* @param path File to write
* @param id Name of the HDF group in which to store frame data
*/
def writeHdfFile(path: String, id: String) {
H5Store.writeFrame(path, id, frame)
}
} // end new
}
但是,我從來沒有見過的= new {
語法。這是否意味着它每次都創建並返回一個新函數?爲什麼會更有意義而不僅僅是做= {