Finishing string support: reference counting

Follow the development of the SharpBASIC compiler and share your thoughts and ideas.
Locked
User avatar
frank
Site Admin
Posts: 40
Joined: Sun Nov 21, 2021 12:04 pm
Location: Netherlands
Contact:

Finishing string support: reference counting

Post by frank »

Finishing string support takes longer due to the implementation of a reference count system, which will use the ownership model similar to what is proposed for the Lobster language. The advantage of this system is that the reference counting is mainly done during compile time, which should take away around 95% of the traditional runtime reference count operations. Another reason for implementing an ownership model is to prevent unexpected changes to string references, such as:

Code: Select all

x = "hello";
s(x);

sub s(y: str)
do
  x = "world";
  print(y);       ' should print "hello" as being the new owner
end;
This is going to take some time...
Last edited by frank on Thu Dec 30, 2021 2:41 pm, edited 1 time in total.
Keep it simple!
Locked