# Defaulting To Frozen String Literals

> The cold never bothered me anyway.

The release of Ruby 2.2 introduced the ability to freeze string literals, making them immutable. With the release of Ruby 2.3, strings can be frozen by default without the use of `#freeze`. By adding the following magic comment at the top of a file

```ruby
# frozen_string_literal: true
```

all string literals will default to frozen. That means that all string literals in that file are immutable, cannot be modified. This gives the Ruby interpreter some performance gains due to reduced object allocation.

This is the [issue](https://bugs.ruby-lang.org/issues/11473) that introduced it.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ploegert.gitbook.io/til/programmy/ruby/defaulting-to-frozen-string-literals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
