An example, you can rewrite the calling program in a module.(https://metacpan.org/pod/Acme::Bleach orhttps://metacpan.org/release/DCONWAY/Lingua-Romana-Perligata...)
While cool for jokes or serious DSL's, it may lead to difficult to understand code. (Nothing wrong with Damian Conway btw, I just remembered he used source filters in interesting ways).
There are different styles, but in general they are concise, and I like them.
perl use various sigils to remain concise, while other languages take a lot of room on the screen: too many letters in the usual function names, not enough sigils within the language.
It's like if everything was in binary or hex, instead of using the full range of ASCII: while technically possible, it may be harder to fit into your head
Python has one sub-style I dislike the most: using tabs for indentation, because how much EXTRA room they use on the screen.
It must not just be me, as there are solutions for coloring the spaces (I forked https://github.com/csdvrx/indent-rainbow to focus on black-and-white and using spaces instead of tabs)
I use space to limit the issue, but I can't make python less verbose.
> it gives you all the tools to shoot yourself in the foot and take away the leg with it.
python isn't innocent either: I recently traced a issue where exit(0) wasn't working to a threading problem, making a bad use of atexit.
I don’t know a single Python project that does it. You can’t mix space and tabs for indentation.
4 spaces is the default for Python formatters like black, ruff (not sure whether it is configurable—never tried to change).
Big indent is a feature—deep nesting is a code smell.
Can you not adjust your tab stops?
I hate it too, because tabs look like spaces and they have a different syntactic meaning
function TabCollapse_Toggle() abort
if &tabstop ==1
set tabstop=8
else
set tabstop=1
endif
endfunction
BTW if you hate tabs looking like other characters and other invisible characters (like spaces at the end of line, non breaking spaces...), I have a solution in CuteVim (https://github.com/csdvrx/CuteVim : just run the portable executable) where I mapped it by default to a Fxx keyIf you already use vim, here's the relevant part: assuming your Shift-F11 is free, add to your vimrc:
" Default is off, `se list` to turn on and `se nolist` to turn off
" Traditional with ISO-8859-1:
"set listchars=tab:»·space:_,trail:·,eol:¶
" Or cuter with unicodes:
set listchars=tab:↹⇥,space:_,nbsp:␣,trail:•,extends:⟩,precedes:⟨,eol:↲
set showbreak=↪
inoremap <silent> <S-F11> <Esc>:set list!<CR>
noremap <silent> <S-F11> :set list!<CR>
Shift-F11 will then become a toggle, to show you tabs: you will see ↹ where the tab starts, and ⇥ for how long it is
I've used this in vim for years:
:se expandtab tabstop=4 shiftwidth=4
(those can be abbreviated, check docs)
Then:
I use only tabs for indentation.
All the tabs get expanded to four spaces each.
Indenting and unindenting lines or blocks of lines, moves them by four spaces.
Never had a problem.
Maybe there are more fancy ways, but this works fine for me.
> All the tabs get expanded to four spaces each.
Then Python will not work (?)
Maybe it is you who "will not work".
Did you try it before commenting? I already said it works fine.
Writing readable perl is easy, just code it like it's LISP.
Granted, he was working with it in AI/bioinformatics.
One of my classmates who moved into the IT/management side of things historically got much quicker responses from the dev team whenever he volunteered to code something, as he was always going to do it in perl.
Perl with list comprehensions do look a bit like line noise...
https://en.wikipedia.org/wiki/Comparison_of_programming_lang...
... but not really worse than most other languages there.
By contrast, its "higher order functions" are useful but relatively speaking, read like someone shook a box of leftover syntax all over them.
https://en.wikipedia.org/wiki/Higher-order_function#Perl
Even though C# has a seizure in the middle, Perl still seems the clunkiest.
Making a large code base easy to read is very hard. People often work on tiny code bases and talk about how easy it is to read, not understanding that they are comparing something with a couple thousand lines of code to something with tens of millions.
I'm not sure what you're referring to (link?) but note that whether C++ code is good or bad can depend strongly on the tooling. Certain coding patterns can be fantastic when your tooling can adequately detect their misuse, and awful when it doesn't. Which means sometimes you can't tell just look at code and tell whether it is good or bad.
> But most of old cooperate, Microsoft or Stroustrup code is just horrible, worse than hard-core perl nonsense.
I got the impression Microsoft's C code was always pretty good, their C++ not so much a decade ago - not sure how their C++ is now.
A frequent opinion. Easy way to fit in for people who never bothered to learn the language. Which is all the more sad that Perl is super easy to learn (one layer at a time).
But I like Perl (and other languages) too.
Variety is the spice of life.