FILEREF type is non-linear?

35 weergaven
Naar het eerste ongelezen bericht

d4v3y_5c0n3s

ongelezen,
11 jul 2021, 20:02:3911-07-2021
aan ats-lang-users
Just a quick question: I noticed that the "FILEREF" type in ATS is non-linear.  Does this mean that I need to enable garbage collection to work with files?  Or is the value freed but hidden from the linear type system?

gmhwxi

ongelezen,
18 jul 2021, 14:18:0018-07-2021
aan ats-lang-users


FILEref is abstract; it is just FILE* in C. As it is non-linear, you
need to remember to close an opened file handle of this type.

BTW, FILEptr is linear; so the type system help you keep track of
file handles of the type FILEptr.

--Hongwei

PS: I often use FILEref first. If needed later, I can always change
it to FILEptr and the typechecker will then lead me to all the places
where subsequent changes are needed for such a change.

d4v3y_5c0n3s

ongelezen,
22 jul 2021, 09:20:2322-07-2021
aan ats-lang-users
Thanks for the help, I was curious about FILEref because I will soon need to work with files in my ATS project.  I hope AT3's development is going well! :)
Allen beantwoorden
Auteur beantwoorden
Doorsturen
0 nieuwe berichten