2
這兩個F#類型簽名之間有什麼區別(如果有的話)?參數多態性與亞型多態性F#
UseTheStream<'a when 'a :> Stream> : 'a -> unit
和
UseTheStream : (stream : Stream) -> unit
他們是否意味着在這種情況下,同樣的事情?
MSDN說下面講(:>)類型的約束
type-parameter :> type -- The provided type must be equal to or derived from the type specified, or, if the type is an interface, the provided type must implement the interface.
這表明這兩個簽名都在說同樣的事情。所以功能上,他們有什麼不同?
謝謝你爲我澄清這一點。 – Eric
不客氣。 – Daniel