Hacker News new | ask | show | jobs
by mc4ndr3 1534 days ago
They're like enums but without the risk of colliding across unrelated contexts. And because they're dynamically generated you can have runaway symbol generation that triggers a memory consumption problem.

Newbies try to use strings as enums, because they don't understand enums. Symbols provide tradeoffs compared with both.

This is what you get with a dynamic language where people try to overload functions with "I accept a scalar OR an array!!!"

1 comments

From the caller's perspective there's little difference between a procedure with variadic arguments and multiple dispatch. There's a lot of difference from the implementor's perspective, though. In Perl 5 you'd see a lot of ref() and wantarray() while in Raku you'd see different signatures for procedures with the same name.