The Crystal programming language 1.0 is now available.

The release of the Crystal programming language 1.0 has taken place. This release is marked as the first significant version, summarizing 8 years of work and signifying the stabilization of the language and its readiness for use in production projects. The 1.x branch will maintain backward compatibility and guarantees no changes in the language and standard library that negatively affect the compilation and functionality of existing code.

The 1.0.y releases will include only corrective fixes, while 1.x.0 versions will offer new functionality and significant changes while maintaining compatibility with existing code. New ideas and potentially incompatible changes will evolve in a separate branch, based on which the Crystal 2.0 release will later be formed. Some features of Crystal 1.0 are designated as experimental and, despite being available in the 1.0 branch, they do not fall under official support. Among these features are single-threading, operation on the Windows platform, and use on systems with ARM processors.

It is worth noting that the developers of Crystal aim to combine the ease of development seen in Ruby with the high performance of applications typical of C. The syntax of Crystal is similar to Ruby, but not fully compatible with it, even though some Ruby programs run without modification. The compiler's code is written in Crystal and is distributed under the Apache 2.0 license.

The language employs static type checking, implemented without the need to explicitly declare types for variables and method arguments in the code. Programs written in Crystal compile into executable files, with macro calculations and code generation occurring at compile time. In Crystal programs, bindings written in C can be included. Parallel execution of code is achieved using the keyword 'spawn', which allows for launching background tasks asynchronously without blocking the main thread, in the form of lightweight threads called fibers.

The standard library provides a large set of typical functions, including tools for processing CSV, YAML, and JSON, components for creating HTTP servers and supporting WebSocket. During the development process, the command 'crystal play' is convenient as it creates a web interface (by default localhost:8080) for the interactive execution of code in the Crystal language.

Key Changes:

  • In tuples, indexed access to elements of different types is allowed, as the compiler knows the type of each element. For example: tuple = {1, "hello", 'x'} v = tuple[0..1] # will yield {1, "hello"} typeof(v) # => Tuple(Int32, String)
  • In string and character literals, using surrogate abbreviations in Unicode escape sequences, such as "\uD834", is prohibited. To encode arbitrary values, the notation "\x" should be used.
  • A large portion of definitions, macros, and methods previously marked as deprecated has been removed from the standard library. This includes methods such as Set, StaticArray#[], YAML.new, HTTP::Request, HTTP::WebSocket, Hash#delete_if, Process#kill, etc.
  • In getter and property macros, specifying the return type is now mandatory.
  • The default rounding method has been changed to TIES_EVEN ("banker's rounding", to the nearest integer, and in edge cases, to the nearest even number). The Number#round method has added a parameter RoundingMode, allowing for the selection of a rounding method. Available methods include: TIES_EVEN, TIES_AWAY, TO_ZERO, TO_POSITIVE, TO_NEGATIVE.
  • Enumerable#flat_map and Iterator#flat_map now work with elements of mixed types in collections.
  • When serializing Enum sequences, string representations with underscores are now used.
  • Types defined in the XML module have been transitioned from using struct to class.
  • For security reasons, decoding of Cookie names has been discontinued, as well as the encoding and decoding of Cookie values (re-encoding has been delegated to frameworks and applications). The HTTP::Cookies.from_headers method has been split into two variants for servers and clients.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster