You can edit almost every page by Creating an account and confirming your email.

Sidef

From EverybodyWiki Bios & Wiki


Sidef
ParadigmMulti-paradigm: object-oriented, functional, procedural
Designed byDaniel Șuteu and Ioana Făculșan
DeveloperDaniel Șuteu and others
First appeared2013; 13 years ago (2013)
Stable release
26.06 / June 2026; 2 months ago (2026-06)
Typing disciplineDynamic, optional static
Implementation languagePerl, Ruby
OSCross-platform
LicenseArtistic 2.0
Filename extensions.sf .sm
WebsiteGitHub – trizen/sidef
Influenced by
Ruby, Raku, Go, Julia

Search Sidef on Amazon.

Sidef is a high-level, general-purpose, interpreted programming language that combines the expressiveness of Ruby, the versatility of Raku (formerly Perl 6), and a strong built-in computer algebra system for mathematical and number theoretic computing.[1] Designed by Daniel Șuteu and Ioana Fălcușan, it first appeared in 2013 and is implemented in Perl and Ruby, allowing it to run on any platform that supports Perl 5.18 or later.[1][2]

The name "Sidef" is a Romanian word, pronounced "C-def", meaning "nacre" in English.

History

Sidef was created by Daniel Șuteu and Ioana Fălcușan and was first released in 2013.[1] Its development is actively maintained on GitHub and the interpreter is distributed as a Perl module on the Comprehensive Perl Archive Network (CPAN).[2]

The language draws heavy inspiration from several established languages: its syntax and object-oriented features are influenced by Ruby; its design for expressiveness and flexibility borrows from Raku; and it incorporates ideas from Go and Julia.[1] The project has maintained a continuous, long-term release cycle, culminating in major updates such as version 26.06 in June 2026.

Features

Sidef is a multi-paradigm language designed for versatile applications, supporting:[1]

  • Object-oriented programming with classes, inheritance, and multiple dispatch.
  • Functional programming with first class functions, closures, and functional pattern matching.[1]
  • Procedural programming for traditional imperative styles.
  • Lexical scoping and keyword arguments.
  • Multiple dispatch (method overloading based on argument types).
  • Optional lazy evaluation and dynamic type checking.[1]

Syntax flexibility and operator precedence

A notable characteristic of Sidef is its high degree of syntax flexibility, which makes the language highly adaptable for constructing domain-specific languages (DSLs).[2] The language implements an approach to operator precedence by evaluating operations based on whitespace spacing rather than conventional fixed precedence rules.[2] For instance, mathematical expressions constructed without spaces are processed strictly right-to-left, whereas heavily spaced operators flip the evaluation to a left-to-right priority.[2]

Mathematical and numerical capabilities

Sidef is distinguished by its extensive built-in support for high precision mathematics:

  • Exact rational arithmetic by default (e.g., 1/3 + 1/6 evaluates to 1/2).[2]
  • Arbitrary precision support for big integers, rationals, floats, and complex numbers.[1]
  • A robust number theory library featuring over 1,000 built-in functions, extensively utilized in computational number theory and contributions to the OEIS. The math engine is backed by the GMP, MPFR, and MPC libraries via Perl interfaces like Math::GMPz and Math::MPFR.
  • Native support for Gaussian integers, quaternions, matrices, and polynomials.

Integration and tooling

  • Seamless integration with Perl modules – Sidef programs can leverage the entire Perl ecosystem natively.[1]
  • Regular expressions and powerful string interpolation.[1]
  • Runtime metaprogramming and optional dynamic type checking.
  • A REPL environment with an interactive help system (accessible via the -H flag).[1]

Syntax

Sidef's syntax is designed to be clean, actively avoiding mandatory semicolons, and feeling familiar to users of Ruby and Perl.[2] Source files use the .sf extension.

A "Hello, World!" program:

say "Hello, World!"

Variables are declared with the var keyword:[2]

var x = 42
var name = "Sidef"

Functions are defined with func:

func factorial(n) { n < 2 ? 1 : (n * factorial(n-1)) }

The language includes native, fluid methods for complex mathematical tasks:

say 29.primes          #=> [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
say factor(2**64 - 1)  #=> [3, 5, 17, 257, 641, 65537, 6700417]

Implementation

Sidef is implemented in Perl (with aspects bridging into Ruby) and distributed as a CPAN module.[1] The interpreter works by parsing Sidef source code into an abstract syntax tree (AST), which is then optimized (including constant folding) before being compiled to Perl code and executed.

The standard distribution includes:

  • A native lexical parser for Sidef.
  • An optimizer that performs constant folding and AST transformations.
  • A compiler that translates Sidef AST directly into Perl code.
  • An interactive REPL environment.

The implementation relies heavily on underlying C libraries—specifically GMP, MPFR, and MPC—bridged via Perl modules to ensure fast execution speeds for big-integer and arbitrary-precision floating-point arithmetic.

Community and ecosystem

Sidef has a well-established presence on GitHub, where its source code repository is hosted and development issues are tracked.[1] Comprehensive documentation is actively maintained via GitBook alongside a detailed Beginner's Guide.

The language is widely represented on Rosetta Code, demonstrating concise solutions across thousands of programming tasks, and can be evaluated instantly online via platforms like Try It Online (TIO).[1]

Sidef is packaged for several mainstream Linux distributions, accessible natively in Slackware and via the AUR for Arch Linux users.[1]

License

Sidef is free software released under the terms of the Artistic License 2.0, permitting open modification, commercial use, and redistribution.[1]

See also

References

  1. 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 Wegrzanowski, Tomasz (May 17, 2020). "100 Languages Speedrun — Episode 87 — Sidef". DEV Community. Retrieved 2026-06-20.

External links


This article "Sidef" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Sidef. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.