LIMITATIONS

Limitations of the Russian Module

This document outlines the current limitations of the Russian language module for Raku and explains what is and isn't possible with the current implementation.

Overview

The Russian module provides over 200 Russian function names covering most aspects of Raku programming. However, due to technical limitations in the Rakudo compiler, it cannot currently provide full syntax modifications for control structures and declarations.

What Works

Function Names

All core Raku functions can be called using Russian names:

  • скаТи instead of say

  • ΠΏΠ΅Ρ‡Π°Ρ‚ΡŒ instead of print

  • сумма instead of sum

  • And 200+ more functions

Constants

Russian names for common constants:

  • истина for True

  • лоТь for False

  • пусто for Nil

  • Π±Π΅ΡΠΊΠΎΠ½Π΅Ρ‡Π½ΠΎΡΡ‚ΡŒ for Inf

Custom Operators

The module includes Russian-named operators that work as infix, prefix, and postfix operators:

use Russian;

# Arithmetic operators
5 плюс 3                    # returns 8
10 минус 4                  # returns 6
6 ΡƒΠΌΠ½ΠΎΠΆΠΈΡ‚ΡŒ 7                # returns 42
2 ΡΡ‚Π΅ΠΏΠ΅Π½ΡŒ 8                 # returns 256

# Comparison operators
5 большС 3                  # returns True
10 Ρ€Π°Π²Π½ΠΎ 10                 # returns True
"ΠΏΡ€ΠΈΠ²Π΅Ρ‚" строка_Ρ€Π°Π²Π½Π° "ΠΏΡ€ΠΈΠ²Π΅Ρ‚"  # returns True

# Logical operators
истина ΠΈ лоТь               # returns False
истина ΠΈΠ»ΠΈ лоТь             # returns True
Π½Π΅ истина                   # returns False

# String operators
"ΠŸΡ€ΠΈΠ²Π΅Ρ‚" соСдини " ΠΌΠΈΡ€!"    # returns "ΠŸΡ€ΠΈΠ²Π΅Ρ‚ ΠΌΠΈΡ€!"

# Range operators
1 Π΄ΠΎ 5                      # returns 1..5
1 до_искл 5                 # returns 1..^5

What Doesn't Work

Control Structures

Cannot use Russian keywords for control flow:

  • Ссли instead of if

  • ΠΈΠ½Π°Ρ‡Π΅ instead of else

  • для instead of for

  • ΠΏΠΎΠΊΠ° instead of while

  • Π΄Π°Π½ΠΎ instead of given

  • ΠΊΠΎΠ³Π΄Π° instead of when

Declarations

Cannot use Russian keywords for declarations:

  • ΠΌΠΎΠΉ instead of my

  • наш instead of our

  • класс instead of class

  • Ρ€ΠΎΠ»ΡŒ instead of role

  • ΠΌΠΎΠ΄ΡƒΠ»ΡŒ instead of module

  • ΠΏΠΎΠ΄ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ° instead of sub

  • ΠΌΠ΅Ρ‚ΠΎΠ΄ instead of method

Type Constraints

Cannot use Russian names in type declarations:

  • Π‘Ρ‚Ρ€ΠΎΠΊΠ° instead of Str

  • Π¦Π΅Π»ΠΎΠ΅ instead of Int

  • Массив instead of Array

Technical Background

The Slang Mechanism

Raku supports "slangs" (sub-languages) that can modify the grammar to support different syntaxes. This is how Raku can support regex syntax, quote constructs, and potentially other language syntaxes.

Rakudo Issue #2404

There is a known bug in the Rakudo compiler (GitHub issue #2404) that prevents custom slangs from working properly. This bug blocks the implementation of full Russian syntax support.

Current Workaround

The module uses Raku's EXPORT mechanism to provide Russian-named functions. This approach:

  • Works reliably

  • Covers most practical programming needs

  • Is compatible with all Raku versions

  • Cannot modify core syntax

  • Cannot change keywords

Future Possibilities

Once Rakudo issue #2404 is resolved, it will be possible to implement:

  1. Full Grammar Modifications

    • Russian keywords for all control structures

    • Russian keywords for declarations

    • Russian syntax for class definitions

  2. Seamless Integration

    # This would become possible:
    класс ЧСловСк {
        ΠΈΠΌΠ΅Π΅Ρ‚ $.имя;
        ΠΌΠ΅Ρ‚ΠΎΠ΄ привСтствиС() {
            скаТи "ΠŸΡ€ΠΈΠ²Π΅Ρ‚, мСня Π·ΠΎΠ²ΡƒΡ‚ $.имя";
        }
    }
    
    мой $person = ЧСловСк.new(:имя("Иван"));
    Ссли $person.имя {
        $person.привСтствиС();
    }
  3. Mixed Language Support

    • Ability to mix Russian and English syntax

    • Gradual migration paths for codebases

Practical Impact

Despite these limitations, the Russian module is still highly useful:

  1. Teaching Programming: Students can learn programming concepts using Russian function names

  2. Domain-Specific Code: Mathematical and scientific computing can use familiar Russian terminology

  3. Gradual Adoption: Teams can start using Russian functions while keeping English syntax

  4. Documentation: Code comments and documentation can be entirely in Russian

Examples of Current Usage

What You Can Write Today

use Russian;

# Functions work perfectly
скаТи "ΠŸΡ€ΠΈΠ²Π΅Ρ‚, ΠΌΠΈΡ€!";
my @числа = 1..10;
скаТи "Π‘ΡƒΠΌΠΌΠ°: ", сумма(@числа);
скаТи "ΠšΠ²Π°Π΄Ρ€Π°Ρ‚Ρ‹: ", ΠΎΡ‚ΠΎΠ±Ρ€Π°Π·ΠΈΡ‚ΡŒ({ $_ ** 2 }, @числа);

# Constants work
my $ΠΏΡ€Π°Π²Π΄Π° = истина;
if $ΠΏΡ€Π°Π²Π΄Π° {
    скаТи "Π­Ρ‚ΠΎ ΠΏΡ€Π°Π²Π΄Π°!";
}

# Mathematical functions
скаТи "Бинус Ο€/2 = ", синус(ΠΏΠΈ/2);
скаТи "ΠšΠΎΡ€Π΅Π½ΡŒ ΠΈΠ· 16 = ", ΠΊΠΎΡ€Π΅Π½ΡŒ(16);

What You Cannot Write (Yet)

# This syntax is NOT currently supported:
моС $имя = "Блава";
Ссли $имя Ρ€Π°Π²Π½ΠΎ "Π‘Π»Π°Π²Π°" {
    скаТи "Здравствуй, Π‘Π»Π°Π²Π°!";
} ΠΈΠ½Π°Ρ‡Π΅ {
    скаТи "ΠšΡ‚ΠΎ Ρ‚Ρ‹?";
}

для 1..5 -> $н {
    скаТи "Число: $н";
}

Conclusion

While the Russian module cannot currently provide complete Russian syntax for Raku, it successfully provides Russian names for hundreds of functions, making it valuable for Russian-speaking programmers. The limitations are technical rather than conceptual, and full support will be possible once the underlying compiler issue is resolved.

Russian v0.0.1

Russian language programming for Raku with heritage and modern computing terminology

Authors

  • Danslav Slavenskoj

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Russian
  • Русский

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.