OpenSource

Crystal 1.2 programming language Released

Pinterest LinkedIn Tumblr

The release of the programming language Crystal 1.2 has been published , the developers of which are trying to combine the convenience of development in the Ruby language with the high application performance inherent in the C language. Crystal syntax is close to Ruby, but not fully compatible with it, despite the fact that some Ruby programs are executed without modification. The compiler code is written in Crystal and is licensed under the Apache 2.0 license.

The language uses static type checking, implemented without the need to explicitly specify the types of variables and method arguments in the code. Crystal programs are compiled into executable files, with macro evaluation and code generation at compile time. In programs in the Crystal language, it is allowed to connect bindings written in the C language. Parallelization of code execution is carried out using the “spawn” keyword, which allows you to start a background task asynchronously without blocking the main thread, in the form of lightweight threads called fibers (Fiber).

The standard library provides a large set of common functions, including tools for handling CSV, YAML, and JSON, components for building HTTP servers, and supporting WebSocket. In the development process, it is convenient to use the “crystal play” command, which generates a web interface (by default localhost: 8080) for interactive execution of code in the Crystal language.

The environment for running Linux applications in Windows 11 will be delivered through the Microsoft Store

Major changes in Crystal 1.2 :

  • Added the ability to assign a subclass of a generic class to an element of a parent class.
class Foo (T); end
   class Bar (T) <Foo (T); end
   x = Foo
   x = Bar
  • In macros, you can now use the underscore to ignore the value in the “for” loop.
{% for _, v, i in {1 => 2, 3 => 4, 5 => 6}%}
     p {{v + i}}
   {% end%}
  • Added “file_exists?” Method to macros. to check for the existence of a file.
  • The standard library provides support for 128-bit integers.
  • Added Indexable :: Mutable (T) module to implement extended operations on collections such as BitArray and Deque.
ba = BitArray.new (10) # ba = BitArray [0000000000]
   ba [0] = true # ba = BitArray [1000000000]
   ba.rotate! (- 1) # ba = BitArray [0100000000]
  • Added XML :: Node # namespace_definition method to extract specific namespaces from XML.
  • The IO # write_utf8 and URI.encode methods have been deprecated and should be replaced with IO # write_string and URI.encode_path.
  • Support for 32-bit x86 architecture has been moved to the second level (ready-made packages are no longer generated). A transfer to the first level of support for the ARM64 architecture is being prepared.
  • Work continued to provide full support for the Windows platform. Added support for Windows sockets.
  • For macOS, a universal package has been added that works both on devices with x86 processors and on hardware with an Apple M1 chip.

1 Comment

  1. Pingback: Intel opens the code of the ControlFlag machine learning system to detect errors in the code - itsfoss.net

Write A Comment