home - docs - eval - blog - discord

ASnake v0.11.18

day 7 - month 11 - year 2021


When calling empty dict() or list(), will generate a empty dictionary or list instead:

    x = dict() --> x = {}
    y = list() --> y = []

Loops which call only one function on a iteration now transform into maps:

    loop 12 i to func

Turns into:

    list(map(func, range(12)))

The list function is needed in order to actually execute the function calls.

For loops appending to lists while calling a function now transform into maps:

    for x in thing: myList.append(func(x))

Turns into:

    y = list(map(func, thing))

Pure functions now receive a (depending on python version) @cache or @lru_cache decorator which provides a great speedup to that function.

A silly but real bool optimization trick:

    not not var

Is faster than:


So it replaces that instance. Also works with pipes.


Accepts hexadecimal numbers more properly

is syntax now correctly triggers len function when comparing string and int

Builtin Python functions will now call without ()

Can use type declaration and const syntax in either order.

    const int num 12
    # acts the same as
    int const num 12

Breaking changes:

When using a increment/decrement on a while loop, var++ will apply at the end of a iteration, and ++var will apply at the start of an iteration.


Can specify which Python version to compile to via Meta instead of compiler flag:

    $ pythonVersion = 3.7

Use multiple times to create sections of the code that compile to different versions.

General conclusion:

This version of ASnake is the first to go open source. While few have contributed, it has meant that at least sometimes people use it, and thus rely on it. That has created some good habits to increase stability, and hence the amount of commits for this version. However, I must move on and introduce more features to the language, increasing the reasons anyone should care about it all. In the next release I plan on implementing:

  1. Default print on expressions with functions when inside an f-string, or being operated on.
  2. Accept and ignore >>> as syntax. Makes copy pasting from terminal easier, and confuses beginners less. Potentially should result in compiler warning (not error).
  3. Meta for making function not require parenthesis, like expression print.
  4. Python3.10 support

The next release will be ASnake v0.12.0+

<-- previous - ^ top ^ - next -->