in reply to Legible or Obfuscated?

Yes, normal perl code can sometimes become unreadable for those who don't use perl regularly. But isn't it the same with other programming languages?

APL is infamously hard to read for outsiders, even more than perl. Lisp or Scheme code is reported to be difficult to read for those who're not used to it.

Even some bash code like

# bash functions for manipulating the path shopt -s extglob # addpath appends a directory to the path unless it is already there # eg: addpath ~/bin addpath(){ local a p=":$PATH:"; for a; do case "$p" in (*:"${a%/}"?(/):*);; (*) p="$p$a:";; esac; done; p="${p#:}"; PATH="${p%:}"; } # delpath deletes a dir from the path delpath(){ local a p=":$PATH:"; for a; do a="${a%/}"; p=${p/:"${a}"?(\/):/:}; done; p="${p#:}"; PATH="${p%:}"; } #END
can be impossible to read (I've written this as normal code, not intentionally obfuscated), and even C++ code can get very ugly.

Replies are listed 'Best First'.
Re: Re: Re: Legible or Obfuscated?
by diotalevi (Canon) on Aug 10, 2004 at 14:41 UTC
    Shell code of all varieties is difficult to read. With each OS having different flavors of all the same basic tools it can be really difficult to suss out (without reading reams of manual pages) what something does with all the various options. I hate shell code. Ack. Ptooey. Or .... I hate having to read other people's shell code written for their version of *NIX.
      Shell code of all varieties is difficult to read.

      Spoken like a man who has never supported SQR or read IRS instructions.

      Shell syntax has its quirks, sure. It certainly isn't as powerful as perl or as "clean" as Java or as readable as Applescript. However, for when it was written it was quite an advance. Also, it beats the heck out of DCL on VMS, which is where I first learned to really program, so maybe I look on shell programming with more fondness than others do.

      YMMV

      --
      tbone1, YAPS (Yet Another Perl Schlub)
      And remember, if he succeeds, so what.
      - Chick McGee