4 ms·
Why not before? Because Perl is you know, dead. Jokes aside, it's a pretty nice language apart from the !$double .@sigils. If I'd switch from Perl 5, I'd probab
by petre 7y ago
Why not before? Because Perl is you know, dead. Jokes aside, it's a pretty nice language apart from the !$double .@sigils. If I'd switch from Perl 5, I'd probably switch to Ruby, as Perl 6 oops Raku is quite slow.
- deleted 7y ago[deleted]
- xisukar 7y ago> ... 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/ https://docs.perl6.org/routine/! [2] https://docs.perl6.org/language/variables#index-entry-Twigil https://docs.perl6.org/language/variables#index-entry-Twigil [3] https://docs.perl6.org/language/variables#index-entry-$ https://docs.perl6.org/language/variables#index-entry-$! [4] https://docs.perl6.org/language/faq#Why_sigils?_Couldn't_you_do_without_them https://docs.perl6.org/language/faq#Why_sigils?_Couldn't_you...? [5] https://docs.perl6.org/language/faq#Is_Perl_6_fast_enough_for_me https://docs.perl6.org/language/faq#Is_Perl_6_fast_enough_fo...?
- petre 7y agoOk, 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.
- popovmp 7y agoYou probably mean: `@{ $hash->{array_ref} }` or `@{ $hash(array_ref) }`. Either way shows exactly what is the structure of `hash`.
- petre 7y ago%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.
- SwellJoe 7y agoRuby is also quite slow. The last benchmarks I saw makes it pretty clear Raku has closed the gap with Ruby (at least the mainline C implementation of Ruby) on a lot of fronts, and is likely to be faster for many things in another year or two and the VM gets better at optimization. My google fu isn't up to finding those benchmark results now, but it's no secret that Ruby is pretty sluggish compared to Perl 5.
- yesbabyyes 7y agoHere's a great talk from PerlCon.EU 2019 about Raku Performance given by Jonathan Worthington: https://perlcon.eu/talk/80 https://perlcon.eu/talk/80
- petre 7y agoI sure hope it will be faster because in my own tests it's slower than Tcl. And I've tested at least two releases a year since october 2016 when the stable Rakudo came out. Ruby 2.5 has a jit which uses the C compiler to generate dynamically linked objects. It looks more like a workaround but it produces fast code. Then there's Jruby, Rubinius, Truffle, mruby. Crystal too, which is a different language but yet similar. No need to learn Go. Just take your Ruby background and pretty much start using it for writing Crystal.
- jashmatthews 7y agoThe CRuby 2.6 JIT using gcc or clang improves some benchmarks but makes real applications slower, sadly. Thankfully JRuby already has a functioning JIT and TruffleRuby is getting very close to a 1.0 release.