السلام عليكم,
وجدت في الشروحات مؤثرلاستنباط الاصناف وهو ~type أي انه يتم تحويل متغير الى نوع متغير اخر حسب ما فهمت من ذلك كما في المثال المذكور:
def x: Int[64] ;
def y: x~type; // y here has the same type as x, which is Int[64].
def p: ptr;
p = x~cast[ptr];
p = x~cast[p~type]; // Equivalent to the upper statement.
ولكن رأيت في أحد الامثلة تم استخدام parse من أجل ان يتم التحويل من نوع متغير الى اخر, كما في هذا المثال:
count = 0;
def total: Float[64] = 0;
def i: Int;
// We will skip the header and start from the second line.
for i = 1, i < lines.getLength(), ++i {
if lines(i).trim() == "" continue;
++count;
total += parseFloat(lines(i).split(",")(1));
}
أود ان اعرف ما الفرق بينهما من فضلكم