3 ms·
> I used to think heavy criticism of Perl's use of punctuation characters were valid, until I looked at PHP, Ruby and Rust The mandatory dollar sign in variabl
by azangru 3y ago
> I used to think heavy criticism of Perl's use of punctuation characters were valid, until I looked at PHP, Ruby and Rust
The mandatory dollar sign in variable names looks dumb in php, I grant you that. As well as the dot for string concatenation. But perl insists on the distinction between $variable, @variable, and %variable; which is just wild. How is it that python works fine without all that noise, for chrissake? Or javascript?
- gkbrk 3y agoPython insists on the difference between 2 spaces, 3 spaces, 1 tab, and 2 tabs; which is just wild. How is it that Perl works fine without all that noise, for chrissake? Or Javascript?
- troglodynellc 3y agoIt's to distinguish between references and non-references. pass-by-reference rather than only COW (such as in some languages) is quite useful. You would prefer *ref like in C? You can actually do that (it's a GLOB type). The place people get tripped up is that $scalar can be a string, or a ref. You check that easily with ref $scalar eq 'ARRAY' or whatever guard you want.
- achileas 3y agoDoes Python work fine without all that? If it did, validation and type-checking tools like mypy and pydantic (or the recently introduced Typing in the standard library) wouldn't exist. Or having to write lines and lines of checking code because someone else (also me) forgot to annotate the expected types of some parameters.
- donaldihunter 3y agoI don’t think Python “just works” in this regard. It blows up in your face if you mistake a scalar for a dictionary. In Perl, the sigils are there to help you the programmer distinguish your $scalars from your @arrays and your %hashes. It still blows up in your face if you get it wrong but there’s a visual indicator to help you get it right.