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

> ... apart from the !$double .@sigils

In this case, `!$double` isn't a sigil. `!` is just the old prefix operator for negating a value [1]. If you meant to write `$!double`, then it's the twigil [2] for class attributes [3]. Twigils could be considered as secondary sigils but they affect the scoping of a variable. In this instance, `!` is for class attributes and will only be found there.

As for `.@sigils`, I've never seen this syntax. I'm probably out of the loop in this one.

As an aside, sigils are one of Raku's interesting features. They convey information [4] that might not be easy to discern from just looking at the code. What kind of structure is this variable holding? Is it holding an array? A hash? A code object? What's the scope of this variable? Is it class-scoped? Is it dynamically-scoped? Is it a compile-time variable?

> ... Raku is quite slow.

This is a legitimate reason for avoiding the language. However, it's worth pointing out that Raku core developers have made great improvements to the language in the speed department since it was first officially released in 2015. They recognize there's a lot of room for improvement. [5]

[1] https://docs.perl6.org/routine/!

[2] https://docs.perl6.org/language/variables#index-entry-Twigil

[3] https://docs.perl6.org/language/variables#index-entry-$!

[4] https://docs.perl6.org/language/faq#Why_sigils?_Couldn't_you...?

[5] https://docs.perl6.org/language/faq#Is_Perl_6_fast_enough_fo...?




Ok, twigils, whatever. They're next to each other so they're double the crazyness. Like the $#last_index in Perl. In Raku the . and ! are used to designate a private or public variable within a class definition. I got it backwards, which sort of proves the whole point. Push a private array nested into another and you have a bunch of gibberish worse than in Perl, where you'd only prefix it with \. Use an auxilliary variable and it feels too verbose. OTOH @{$hash{array_ref}} dereferentiation in Perl is quite annoying. And no, $hash{array_ref}->@ is definitely not how you fix this mess. I agree that sigils offer some insight into what type of the variable you are looking at.

Great improvements are not enough compared to other languages, even Ruby which is quite slow itself. Have you wrote anything in Node, Dart or Lua? They feel like a F1 car where Raku is an 17th century cart.


You probably mean: `@{ $hash->{array_ref} }` or `@{ $hash(array_ref) }`.

Either way shows exactly what is the structure of `hash`.


%hash is an actual hash with a nested array ref inside. If $hash is a reference to such a hash, yes. Never used the second syntax and I doubt that it works with something other than subroutines, but in that case it's either hash() where hash is an actual sub, or $hash->() where $hash is a subroutine reference. Both return an array refetence.

See? Confusing. That's why people hate Perl. At least I'm glad dereferencing is gone in Raku.




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

Search: