<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Generics on Nalar</title>
    <link>https://nalar.dev/tags/generics/</link>
    <description>Recent content in Generics on Nalar</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 12 Sep 2026 00:00:00 +0700</lastBuildDate>
    <atom:link href="https://nalar.dev/tags/generics/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Clone Go Maps with maps.Clone</title>
      <link>https://nalar.dev/clone-go-maps-with-maps-clone/</link>
      <pubDate>Sat, 12 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/clone-go-maps-with-maps-clone/</guid>
      <description>&lt;p&gt;A Go map variable refers to mutable map state. Assigning that variable to another variable does not create an independent map: writes through either name affect the same map. When code needs a separate top-level map with the same entries, &lt;code&gt;maps.Clone&lt;/code&gt; makes that boundary explicit.&lt;/p&gt;&#xA;&lt;p&gt;The function is deliberately narrow. It copies map entries using ordinary assignment. The resulting map can be changed independently at the key-value entry level, but reference-like data stored inside keys or values can still share underlying state.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Compare Map Values with maps.EqualFunc in Go</title>
      <link>https://nalar.dev/compare-map-values-with-maps-equalfunc-in-go/</link>
      <pubDate>Sat, 12 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/compare-map-values-with-maps-equalfunc-in-go/</guid>
      <description>&lt;p&gt;Two Go maps can represent the same logical data even when their value types differ or their values need domain-specific comparison. &lt;code&gt;maps.EqualFunc&lt;/code&gt; handles that case by matching keys normally while delegating value comparison to a caller-supplied function.&lt;/p&gt;&#xA;&lt;p&gt;That split matters. The comparator controls value equivalence only. It cannot redefine key identity, compensate for a missing key, or make maps with different entry counts equal.&lt;/p&gt;&#xA;&lt;h2 id=&#34;key-membership-is-checked-before-value-equivalence&#34;&gt;Key membership is checked before value equivalence&lt;/h2&gt;&#xA;&lt;p&gt;The function accepts two maps with the same key type but potentially different value types:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Filter Map Entries in Place with maps.DeleteFunc</title>
      <link>https://nalar.dev/filter-map-entries-in-place-with-maps-deletefunc/</link>
      <pubDate>Sat, 12 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/filter-map-entries-in-place-with-maps-deletefunc/</guid>
      <description>&lt;p&gt;Filtering a Go map often means removing entries from an existing map rather than allocating a replacement. &lt;code&gt;maps.DeleteFunc&lt;/code&gt; expresses that operation directly: it visits entries and deletes each pair for which a predicate returns &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That mutation model is the central detail. The function does not return a filtered copy, and callers that share the same map observe the deletions.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-predicate-receives-both-key-and-value&#34;&gt;The predicate receives both key and value&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;maps.DeleteFunc&lt;/code&gt; accepts a map and a function with the key and value types of that map. A compact filter can use either argument or both:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Merge Map Entries with maps.Copy in Go</title>
      <link>https://nalar.dev/merge-map-entries-with-maps-copy-in-go/</link>
      <pubDate>Sat, 12 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/merge-map-entries-with-maps-copy-in-go/</guid>
      <description>&lt;p&gt;Merging two Go maps often comes down to one precise rule: entries from one map are assigned into another, and matching keys replace existing destination values. &lt;code&gt;maps.Copy&lt;/code&gt; gives that operation a standard-library form without changing its underlying assignment semantics.&lt;/p&gt;&#xA;&lt;p&gt;The function mutates the destination map. It does not allocate a replacement, return a merged value, or recursively copy data stored behind pointers, slices, maps, or other reference-bearing values.&lt;/p&gt;&#xA;&lt;h2 id=&#34;source-entries-overwrite-matching-destination-keys&#34;&gt;Source entries overwrite matching destination keys&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;maps.Copy&lt;/code&gt; accepts a destination followed by a source. Every source pair is assigned to the destination. Keys that exist only in the destination remain present.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
