5
इस मामले में इनलाइनिंग क्यों काम नहीं करती है?टुपल्स के लिए यह इनलाइनिंग क्यों काम नहीं करती है?
type TupleBuilder() =
static member inline Cons(a,(b,c)) = (a, b, c)
static member inline Cons(a,(b,c,d)) = (a, b, c, d)
static member inline Cons(a,(b,c,d,e)) = (a, b, c, d, e)
let inline cons h t = TupleBuilder.Cons(h,t)
TupleBuilder.Cons
करने के लिए कॉल मेरा पीछा संकलक त्रुटि
A unique overload for method 'Cons' could not be determined based on type
information prior to this program point. A type annotation may be needed.
Candidates:
static member TupleBuilder.Cons : a:'a0 * ('a1 * 'a2 * 'a3 * 'a4) -> 'a0 * 'a1 * 'a2 * 'a3 * 'a4,
static member TupleBuilder.Cons : a:'a0 * ('a1 * 'a2 * 'a3) -> 'a0 * 'a1 * 'a2 * 'a3,
static member TupleBuilder.Cons : a:'a0 * ('a1 * 'a2) -> 'a0 * 'a1 * 'a2
कंपाइलर को आपके 'cons' फ़ंक्शन में कितने तत्व हैं? उपयोग देखने के बिना, यह नहीं पता कि 't' एक 2-ट्यूपल, 3-टुपल, या 4-टुपल है या नहीं। – rmunn
अच्छी तरह से 'इनलाइनिंग' मदद करता है क्योंकि यह कॉल साइट के निर्णय में देरी करता है। लेकिन यहाँ नहीं। तो मुझे आश्चर्य है – robkuz