Hacker News new | past | comments | ask | show | jobs | submit login

It certainly does. (Or rather Rakudo the compiler for Raku does.)

There are some for people coming from Perl.

    say $^V;

    ===SORRY!=== Error while compiling:
    Unsupported use of $^V variable; in Raku please use
    $*RAKU.version or $*RAKU.compiler.version
    ------> say $^Vā<EOL>
Some for simple typos.

    my $morning = DateTime.now.truncated-to('day').later( :9hours );
    say $moroning;

    ===SORRY!=== Error while compiling:
    Variable '$moroning' is not declared.  Did you mean '$morning'?
    ------> say ā$moroning;


There are some errors that it can't find until it runs your code.

    say $var.length;

    No such method 'length' for invocant of type '...'.  Did you mean
    any of these: 'elems', 'chars', 'codes'?
(I omitted the type because it doesn't really matter.)

The reason Raku doesn't use `length` is because of the common Perl error of calling `length` on an array.

In Perl `length` is a string operation. It would turn your array into a number representing the number of elements, and get the count of characters in that. So it would give you a number representing the order of magnitude of an arrays length.

In order to catch this error, and to reduce the number of times it happens, `chars`, `codes`, and `elems` were chosen instead. (Functions in Raku are intended to do a single operation on a single type. If the argument isn't that type it often coerces into that type. `elems` for example is a list operation, so something like `Str.elems()` always returns `1`.)

Most exceptions are in https://github.com/rakudo/rakudo/blob/master/src/core.c/Exce...




Applications are open for YC Winter 2022

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: