<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Guarantees and safety on TrustLang</title>
		<link>https://trust-lang.net/en/docs/safety/</link>
		<description>Recent content in Guarantees and safety on TrustLang</description>
		<generator>Hugo</generator>
		<language>en</language>
		
		
		
		
			<atom:link href="https://trust-lang.net/en/docs/safety/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Memory management and shared access</title>
				<link>https://trust-lang.net/en/docs/safety/memory/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://trust-lang.net/en/docs/safety/memory/</guid>
				<description>&lt;p&gt;No single memory management approach is the best or universal: different approaches win under different conditions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Manual memory management can do anything, except one thing — guarantee the absence of errors.&lt;/li&gt;&#xA;&lt;li&gt;Ownership and borrowing analysis at compile time makes it possible to prove the correctness of code without additional&#xA;runtime checks, but some scenarios and algorithms cannot be proven statically at compile time.&lt;/li&gt;&#xA;&lt;li&gt;Counting strong and weak references at runtime is convenient for shared ownership, but has a non-zero&#xA;cost and does not protect against cyclic and cross dependencies.&lt;/li&gt;&#xA;&lt;li&gt;Garbage collection simplifies working with complex cyclic structures, but has the most expensive overhead&#xA;and non-deterministic execution.&lt;/li&gt;&#xA;&lt;li&gt;None of the listed memory management approaches includes the issues of inter-thread&#xA;memory access synchronization.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Therefore, choosing only one memory management approach in a programming language means deliberately limiting its capabilities and adding unnecessary overhead. For these reasons, the memory management concept of &lt;em&gt;TrustLang&lt;/em&gt; allows extending the implementation of the memory management model with minimal impact on the language syntax and is defined by the requirements (guarantees) for working with memory.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Stack overflow protection (stack check)</title>
				<link>https://trust-lang.net/en/docs/safety/stack_check/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://trust-lang.net/en/docs/safety/stack_check/</guid>
				<description>&lt;p&gt;&lt;em&gt;TrustLang&lt;/em&gt; has built-in &lt;a href=&#34;https://github.com/afteri-ru/stack-check&#34;&gt;stack overflow protection&lt;/a&gt;. Before calling a protected function, the free space on the thread stack is checked, and if it is insufficient — instead of abnormal termination of the whole application (&lt;code&gt;segmentation fault&lt;/code&gt;), a &lt;strong&gt;program exception &lt;code&gt;stack_overflow&lt;/code&gt;&lt;/strong&gt; is created, which can be caught and handled inside the application, after which program execution continues.&lt;/p&gt;&#xA;&lt;p&gt;A detailed description of the implementation and usage methods will be here.&lt;/p&gt;&#xA;&lt;p&gt;For now you can look at usage examples: &lt;a href=&#34;https://trust-lang.net/en/playground/?file=fibonacci&#34;&gt;recursive computation of Fibonacci numbers&lt;/a&gt; and &lt;a href=&#34;https://trust-lang.net/en/playground/?file=prime&#34;&gt;recursive primality check&lt;/a&gt;&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
