Subject:
|
TMTOWTDI (was: Re: NQC in Boston University Linux :))
|
Newsgroups:
|
lugnet.off-topic.geek
|
Date:
|
Fri, 7 Apr 2000 17:41:15 GMT
|
Viewed:
|
214 times
|
| |
| |
In lugnet.off-topic.geek, Dan Boger writes:
> [...] As for perl/python, well, I like
> having more than one way of doing things... the quick and dirty
> solution, and the incredibly elegant one... and about 50 in between.
> That way, my poor little brain doesn't have to come up with the one
> great one, it can do with the one-that-is-almost-but-no-quite-so-great
> one :)
I'd like to take a close look at Python someday, but I doubt I'll end up
using it if it's got the frustrations of other syntactically challenged
languages. (My favorite programming languages are Perl, PostScript, and
LISP/Scheme/Logo for their extreme flexibility and expressability of
semantics and syntax...although I can't say I truly enjoy LISP or PostScript.)
I wanna add to above that, in addition to quickness vs. elegance, I'm also
very pleased with Perl's TMTOWTDI philosophy on everday things like 'if' and
'unless' and 'and' and 'or' and order-switching.
Even in very carefully written code, I might prefer any of
ref $foo or die "blah"; # assertion that $foo should be a reference
or
!ref $foo and die "blah"; # assertion that $foo should not be a scalar
or
if (!ref $foo) { die "blah"; } # dies for some $foo; emphasis on test
or
unless (ref $foo) { die "blah"; } # dies for most $foo; emphasis on test
or
die "blah" if !ref $foo; # dies for some $foo; emphasis on die
or
die "blah" unless ref $foo; # dies for most $foo; emphasis on die
depending on the nature of the test. I tend to use the 'or' (and on rare
occasions 'and') for assertions and 'if'/'unless' for regular conditions.
Having a choice of 6 (and more) ways to write the same thing makes the code
clearer IMHO because it contains more information; it suggests more than
simply what's there semantically in the compiled code.
I feel crippled in a langage which forces me to write all of the above a
single way -- and not just for quick-hack code.
--Todd
|
|
Message has 1 Reply: | | Re: TMTOWTDI (was: Re: NQC in Boston University Linux :))
|
| (...) Well, in python, that's very easy, since all variables are references. But, for example, to test if 'foo' is a callable object (a function, class, method, etc...), this is the Way: if not callable(foo): sys.exit(1) As I understand it, any (...) (25 years ago, 8-Apr-00, to lugnet.off-topic.geek)
|
Message is in Reply To:
| | Re: NQC in Boston University Linux :)
|
| (...) *hide*. I am getting better though - the other day, I removed netscape from my computer, and did it with rpm -e :) (...) do you also check for space while choosing? RH has this annoying trick, when you painfully choose all the packages you (...) (25 years ago, 7-Apr-00, to lugnet.off-topic.geek)
|
18 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|