<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>References on TrustLang</title>
		<link>https://trust-lang.net/en/tags/references/</link>
		<description>Recent content in References on TrustLang</description>
		<generator>Hugo</generator>
		<language>en</language>
		
		
		
		
			<atom:link href="https://trust-lang.net/en/tags/references/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Context manager (with)</title>
				<link>https://trust-lang.net/en/docs/operators/with/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://trust-lang.net/en/docs/operators/with/</guid>
				<description>&lt;p&gt;The single statement for capturing a reference and synchronizing access to an object (&lt;code&gt;*ref&lt;/code&gt;, &lt;code&gt;*ref(...)&lt;/code&gt;)&#xA;is executed for one action. Capturing a reference/synchronization object is a relatively slow&#xA;operation, so performing it for each action is inefficient. The &lt;strong&gt;context manager&lt;/strong&gt; (&lt;code&gt;with&lt;/code&gt;)&#xA;captures several references/objects at once and performs a group of actions under a common lock,&#xA;and also serves for &lt;strong&gt;automatic resource release (RAII)&lt;/strong&gt; when leaving the block.&lt;/p&gt;&#xA;&lt;p&gt;In the base syntax — the operator &lt;code&gt;**( ... )&lt;/code&gt;; in DSL it corresponds to the macro &lt;code&gt;@with&lt;/code&gt;&#xA;(see &lt;a href=&#34;https://trust-lang.net/en/docs/syntax/macros/&#34;&gt;Keyword syntax (DSL)&lt;/a&gt;). Comparison of the notation forms using&#xA;the example of capturing-locking a reference:&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
