Releases: trizen/sidef
Happy new year!
Version 2.20
New year, new approaches, new experiments!
I'm very happy to announce today the release of Sidef 2.20, which includes a very important change in the core of the language, namely the transition from Math::Big{Float,Int,Rat}
to Math::{MPFR,MPC,GMPz,GMPq}
, which makes Sidef about 6x faster and much more reliable for numerical computations.
Happy new year!
What's new
- Switched from
Math::Big{Float,Int,Rat}
toMath::{MPFR,MPC,GMPz,GMPq}
(445a699) - Added support for initialization of numbers in different bases (from 2 to 36) (dec506c)
- Complex numbers and real numbers are now blended together (1a507bb)
- Added the
Inf
and-Inf
keywords to represent positive and negative infinity - Added the
NaN
keyword to represent theNot a Number
value (be1542b) - New methods inside the
Number
class, such as:fib
,gamma
,is_prime
,primorial
, etc... - Added the
with(expr){...}
statement, similar to that from Perl 6 (bd8c1da) - Added support for Unicode symbols in
Math
constants, such asMath::π
(d67be5d) - Added the
Number.base(n)
method to return a number in a given base (33df118) - Added a new syntax for changing or declaring class variables (
Class!name
) (a86d4cb)
Improvements
- Better support for Complex numbers (b6ed0b9 0c85c73)
- Extended the support for ranges with floating-point numbers (2faee2a)
- Better stringification of numbers (e.g.:
(100! + 1) / 2
will display the exact result) (a86d4cb)
Changes
- Removed the
Byte(s)
,Char(s)
andGraph(s)
built-in types (445a699) - Changed the behavior of
//
operator to mean integer division (d4199ad) - Redefined the behavior for
Inf**0
to return1
, instead ofNaN
(b9fc23f)
Bug-fixes
- Fixed the
String.count(regex)
method to return correctly the number of matches (8affc32)
More changes: 2.13...2.20
Version 2.13
Speed, speed and more speed. This version incorporates many performance improvements and several bug-fixes.
What's new
- Auto evaluation-conversion for lazy-methods (ef52c90)
- Added the
Number.modinv()
method (b049eb0) - Added the
Object.bless
method to return a blessed object in the self class (0603970) - Added the
Array.each_slice(n, {...})
method (5e94052) - Added the
Array.each_cons(n, {...})
method (203ce65) - Added experimental support for changing the global precision and accuracy of numbers (8157b53)
Improvements
- Optimized all the op-assign operators, such as
+=
,-=
, etc... (2dd3ec7) - Simplified the code used in calling subroutines from Perl modules (0b786ec)
- Improved the support for autovivification (4455a3f)
String.first()
andString.last()
will now accept a number as an argument (801ff02)- Optimized the
String.match()
andString.gmatch()
methods (31f81c4) - Better dumping of regular expressions (32262a1)
Pair.first
andPair.second
are now lvalues (93af122)- Optimized and improved the
Array.combinations()
method (be956e5) - Better translation of certain expressions (1e2133f)
- Faster translation of strings with code-points between 127 and 255 (e7c3756)
Array.ft(from, to)
is now considerably faster (3a127a8)- Minor performance improvement in stringification of Boolean values (0968745)
Changes
- Renamed the built-in object
SIG
toSig
(42a1483) - Renamed
Array.each_with_index{}
toArray.each_kv{}
(0cc0dcf) - Renamed
Array.reduce_pairs{}
toArray.pairmap{}
(ce2fc7b) - Blocks will always be called as blocks, and never as functions (782e847)
- In list assignments, the last lvalue is now returned (160c97b)
- Unary operator
-
will now call theneg
method, instead ofnegate
(0621e50) Number.range()
with only one argument is no longer inclusive (6bc3074)
Bug-fixes
- The
__BLOCK__
keyword is now translated correctly as a block (572cabb) - Fixed the
-c
command-line switch to work when Sidef is installed (8b8c966) - Fixed the
Convert.to_f()
method to work with rational numbers (a07896d) - Flat lists as array indices will work as expected (5fa3c64)
More changes: 2.12...2.13
Version 2.12
The multiple dispatch is back!
In addition, this release includes support for functional pattern matching, various optimizations, improvements and several bug-fixes.
What's new
- Support for multiple dispatch (ab914f8)
- Support for functional pattern matching (e756b97)
- Support for class attributes with the
has
keyword. (7de49f0) - Auto-conversion of arguments from Perl callback functions (8c7debc)
- Added the
Array.last_by{}
method (423f190) - Added the
-k
switch to keep track of potential unsafe interpretations (e31de40) - Added the
Array.dig()
andHash.dig()
methods (6ce5ad5) - Added the
...
prefix operator to represent unimplemented code (b1604b3) - Added the
Array.freq()
and theHash.map{}
methods (ae25298) - Added the
String.numbers
andString.each_number{}
methods (1f7991d) - Added the
Hash.count{}
method (59b595d) - Added the
Bool.pick
method which randomly returnstrue
orfalse
(d71f860) - Added the following
Complex
methods:root
,roots
,polars
andreals
(501b714 26f78d4)
Improvements
- Optimized the prefix and postfix
++
and--
operators (ab914f8) - The operator
!=
is slightly faster now (84483ef) - Improved the assertions to include the actual values (d584e60)
- Improved the
given/when
construct (e9f70c7) - All the meta-objects are created directly inside the parser (80bae2e)
- Better localization of the topic variable (
_
) (c723701 6c45643)
Bug-fixes
Array.rotate
will always return a new array (606c837)- Fixed the deparsing of the bare
Block
keyword (754f102) - Deparsing code to Perl (with
-Rperl
) will now includebinmode(STD*, ':utf8')
(4a9ebf1)
More changes: 2.11...2.12
Version 2.11
This version is a minor release which fixes some issues from 2.10 and brings in some new features and improvements.
What's new
- Added the
for var in array {...}
construct, to iterate over an array (436a730) - Added the cross (
~X
) and zip (~Z
) meta-operators from Perl 6 (22f950b) - Added support for checking multiple return-types. (9998e5c)
- Added the rational-division operator (
//
) which creates aMath::BigRat
object (2eac143) - Added the
Array.map_with_index{}
method (3ae5182) - Added the
String.prepend()
which adds a sub-string in front of the self string. (6f5fefb) - Added the
Array.fetch()
andHash.fetch()
methods to fetch a value with a default value (5edff8a)
Improvements
- All variables are now block-scoped, instead of function-scoped. (3507cad)
- Simplified and improved the
local
variables (4409629) - Extended the
String.contains()
method to support regular expressions. (87b8a4a) - Memoization of functions and methods is considerably faster. (6059550)
Array.sum()
andArray.prod()
will accept an argument as a starting value (775fe8f)- Generalized the
Array.index()
andArray.rindex()
to work with objects of any type (d9b1608) - Optimized the
Array.rotate()
method (b73f61a) - Improved the support for assertions to display exactly where the assertion failed (0350534)
die
andwarn
keywords will now display the file and the line number (8710936)- Improved greatly the
-O1
optimization level to cover more constructs (b18f611 e3a1a1f)
Changes
- Modified the
read()
built-in function to accept a message and a type. (de7537b) do
is no longer considered a keyword, unless it is followed by a pair of curly brackets.- Bare blocks can no longer be called with named parameters (3f492c1)
Bug-fixes
- Minor bug-fix in deparsing block arguments with default values. (974f33d)
- Minor bug-fix inside the parser regarding the declaration of variables (451f169)
nil
values are now displayed correctly in interactive mode (-i
) (adebde5)
More changes: 2.10...2.11
Happy Halloween!
Version 2.10
Version 2.10 is here.
This new version includes the first, fully functional Sidef-to-Perl code generator, which replaces the traditional way of interpreting the code (which was by walking the AST).
Instead, we now deparse the AST into an equivalent Perl program, after which we evaluate it. This technique improves the overall run-time performance of Sidef by, at least, 500% (yes, that's correct), and even more in some places such as recursion, looping and method invocations.
In this process many new features had been added to the language, while some old features (not many) are gone.
What's new
- All functions and methods are now closures. (https://github.com/trizen/sidef2/commit/00c22a8e6d5c4f035e5763752c3dd127819bd1b0)
- The
goto
keyword and support for labels. (https://github.com/trizen/sidef2/commit/bcb497366e9ab48a68d1ca13a8132c005f8b0f94) - Support for global variables (https://github.com/trizen/sidef2/commit/f63f2ff22c5b6d3450d7614664d81c9f28f65c69)
- Localization support for magic variables (https://github.com/trizen/sidef2/commit/c9425fe93dc613e00e1150665b67c1814282685d)
- Support for real-constants (https://github.com/trizen/sidef2/commit/60e5b950bf98f71e4a527a41d703bbf45a943c92)
- Support for
do {...} while (expr)
support. (https://github.com/trizen/sidef2/commit/612039ff45780f1805e0f9e23dc27599cd4ae874) - The infix keywords
if
andwhile
(https://github.com/trizen/sidef2/commit/93bfce7d4ce0bc01742afefb2f70131790495e37) - The
Grapheme
andGraphemes
built-in types (https://github.com/trizen/sidef2/commit/915c57f82755f95aea8d41d8451e0914e54fb3dd) - Traits for functions and methods (https://github.com/trizen/sidef2/commit/a4f6f2bff63d6e5b5ebfd75c0c03250f0275a08c)
- The
Array.sort_by {...}
method (0687ff3) - Prefix and postfix dereference (https://github.com/trizen/sidef2/commit/a411e8fd4a5a8b376c9b30d61c09fee4fe8f4618 https://github.com/trizen/sidef2/commit/48b31c887796a24b6b4e982da9ae4e5cb5ce0f68)
Improvements
- Better support for structures (
struct Name { ... }
) (a353469) - More constants can now be declared at once (https://github.com/trizen/sidef2/commit/b169b7404a00a3ac4fe54b35953eca9dfa884b16)
- Stricter rules for comparison operators (https://github.com/trizen/sidef2/commit/428b1af7ca48ce177b98520046f9959eafe4adda)
- Optimized the
Array.uniq
andArray.last_uniq
methods (https://github.com/trizen/sidef2/commit/bd165288d5e8953d36ec847d7fd8211bb039e4a1) - Slurpy parameters now support default values (7bdfafe)
- Better type-checking for typed parameters (ad1f961)
- Better support for named parameters (8097b21)
- Better support for declaration of variables with default values (5952210)
- Method calls can now expand on multiple lines (c1dc82f)
eval()
is considerably faster now (https://github.com/trizen/sidef2/commit/9a965f0629bfa1db79f1077cb1c0d57058e0561c)
Changes
- Semicolons are now fully optional. (https://github.com/trizen/sidef2/commit/612039ff45780f1805e0f9e23dc27599cd4ae874)
- The regex variables (
$1
,$2
,...
) are gone. (1eaf761) - Removed the triple-equal (
===
) operator. (https://github.com/trizen/sidef2/commit/349b25969b1d73c106067801d7f41deb3eddc3c4) - Removed the support for class
def
variables. (https://github.com/trizen/sidef2/commit/c95f6a17ca5a9aa5bf53ea12baffcc0d081ef7be)
Bug-fixes
- The
gather/take
construct is now recursion-friendly. (https://github.com/trizen/sidef2/commit/763f9edab372147b95669ea73e7c93cbab9ffe7f)
Known issues
break(n)
andnext(n)
no longer work (usegoto
instead).- The support for multiple dispatch is currently unimplemented.
More changes:
Version 0.11 (EOL)
EOL
This is the latest version of Sidef which is interpreted by walking the AST. Future versions will include a code generator which will generate Perl code, improving greatly the run-time performance of Sidef.
Changes
- Added experimental support for implicit block calls. (a0c1e81)
- Added the
Class.alias()
method for creating aliases to methods. (3eea5a1) - Fixed the
FileHandle.slurp()
method to work with:utf8
layers in future versions of Perl. (f46fe9b)
More changes: 0.10...0.11-EOL
Version 0.10
What's new
- Added the
Block.all
andBlock.any
methods (6a39c5b) - Added the
Array.index
andArray.rindex
methods (6da2ce7) - Added the following String methods:
bin
,oct
,num
(98e7a11) - Added the
Match.join
method to join the captured matches (087c773) - Added support to assign a value to a reference without dereferencing (d475f33)
- Added the
ClassInit.method
andClassInit.invoke
methods (7fd6816) - Added the
Number.atan
andNumber.atan2
methods (fba18cc) - Added the
Sys.wait
,Sys.fork
andSocket.socketpair
methods (6617f38) - Added the
Range.map
method for number ranges (00fc434)
Improvements
- Improved the
-O3
optimization level (376d7bf, 72ca7d9) Hash.copy
andArray.copy
are now much faster and safer (86d9350)- Extended the
Hash.default
method to accept a block of code. (4522d5b) - Extended the
Hash.delete
method to delete more than one key (8a17915) - Extended the
Number.range
method to accept a third parameter (fa009ac) - Extended the
»op«
hyper-operator to work with arrays of different sizes (3b8612a) - Extended the smartmatch operator (
~~
) to work withRange ~~ Obj
(f45a4c7) - Extended the
MultiArr
object to work with arrays of different sizes (0f4f985) - Added auto-stringification for
Match
andComplex
objects. (1428ebc 6dae437)
Changes
- The output of backticks is no longer UTF-8 decoded (f369175)
- Removed the
camelCase
method-aliases, along with other core changes (19ab31b) - Changed the
given/when
construct to use the smartmatch operator (ceecf82)
Bug-fixes
- Fixed a critical bug related to the initialization of
Math::BigFloat
(9ee37d0) - Returned objects from module calls are now objectified correctly (43e1f00)
- Fixed the
Hash.flip
method -- it works correctly now (86d9350) %w(...)
arrays are now created dynamically at run-time (8f6e9e7)- The unary operators
?
and!
will now work correctly with overloaded objects (41f9013)
More changes: 0.09...0.10
Version 0.09
What's new
- Added support for constant-folding (available at
-O1
) (cc439e4) - Added the map-operator from Perl6 (
array »op» arg
) (2023e2e) - Added the reversed map-operator (
array «op« self
) (04f8897) - Added the
gather/take
construct from Perl6. (#30) (b4e5de6) - Added the
Range.reverse()
method which reverses the self range (33a1ce8) - Added the
Number.divides()
method (80899b1) - Added the
Block.closure
alias forBlock.copy
(97bfe06)
Improvements
- Extended the support for Unicode inside variable names (e9f427f)
- Extended the
Number.range()
method to support two arguments (b95ac45) - Improved the
Block.fork
method; now it's much safer and faster (7923227) - Improved the parsing of here-documents declared with a bareword (8ab0b77)
- Improved the
Math.pi(n)
method; now it's considerably faster forn>1000
(852c857) - Optimized the
Number.array_to()
andNumber.array_downto()
methods (964893a) - Various optimizations inside the parser (e689281 2023e2e 90df3cb)
Changes
Array.minmax
now returns a list instead of an array (80899b1)- Renamed the
my
variables tolocal
variables (7b47eee) - Simplified the internal implementation of ranges (33a1ce8)
- Changed the behavior of the
Math.map()
function (ecc1e67) - A string can no longer match in a range of type number and vice versa (cfcc10e)
- The hyper-operators will now require two angle-brackets in ASCII form (2023e2e)
- Simplified the following
Number
methods:as_oct
,as_hex
andas_bin
(148ecef)
Bug-fixes
- Fixed the deparsing of infinite and NaN numbers (274a8db)
- Fixed the command-line switch
-nBACKEND
to work correctly withMath::BigFloat
andMath::BigRat
objects (88d4728)
More changes: 0.08...0.09
Version 0.08
What's new
- Generalized the syntax for prefix method calls. (3828759 3f119d9)
- Added the
Block.pfork
method, which is a lightweight version ofBlock.fork
(24e928e) - Added the
String.looks_like_number()
method and others (33bf066) - Added the
-C
command line switch to check the syntax of a program (a5332b0) - Added the
assert
,assert_eq
andassert_ne
built-in keywords. (354e22e) - Added the
%s(...)
and%S(...)
quotes (f527e18)
Changes
- Modules are now executed in reversed parse order (4bd4f97)
- Simplified the internal object system, among other core changes (48c1f1f b4da2e2)
Number.divmod()
and some other methods will return a list instead of an array (d0fdf0f)- Added
srand()
after each fork to re-seed the random number generator (8fdb831) - Changed the behavior of the smartmatch operator for
String ~~ String
(0322aab)
Bug-fixes
- Fixed a stack bug for variables initialized inside the condition of a
while
loop (d7eb89e) - Fixed a bug related to overload stringification of various objects (814ae15)
More changes: 0.07...0.08
Version 0.07
What's new:
- Added support for
next
ing two or more loops withnext(n)
. (b9b242e) - Added the
Array.each_index{...}
method to iterate over the indices. (e950204) - Added the
.dump
method for user-defined classes. (758ab9c) - Added the
Class.__class__
method to get the class of an object (502a5ec) - Added the
FileHandle
andDirHandle
types. (5c80e36) - Added the
.levenshtein
method forString
andArray
objects. (f32aae1) - Added the
.METHODS
method for user-defined classes. (6122dd9) - Added the
.method
method for user-defined classes. (dbf29e5)
Improvements:
- Improved the
.METHODS
method for built-in types. (aaa3382) Array.count
now accepts a block of code for counting items. (f32aae1)- Improved the parsing of classes and the parsing of return types from functions. (5c80e36)
- Minor performance improvements. (46b5379, 1a44f27)
Changes:
- Changed slightly the behavior of the smartmatch operator (
~~
) (b1d44e1) - Undefined method calls for user-defined classes are now fatal. (858420f)
File.<=>
andFile.cmp
no longer refer toFile.compare
(e060408)- Removed the following operators:
??
,$$
and^^
. (dad6bd3) - Merged the
PipeHandle
object intoFileHandle
. (5c80e36) - Renamed
has_method
intorespond_to
for user-defined classes. (dbf29e5)
Bug-fixes:
- Fixed a minor bug related to array autovivification on slice creation. (3b7ee7e)
- Minor fix for parsing type-constants. (966223c)