Deutsch English Français Italiano |
<87o73rj3sr.fsf@doppelsaurus.mobileactivedefense.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.nobody.at!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat <rweikusat@talktalk.net> Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc Subject: Re: Command Languages Versus Programming Languages Date: Thu, 10 Oct 2024 17:55:32 +0100 Lines: 73 Message-ID: <87o73rj3sr.fsf@doppelsaurus.mobileactivedefense.com> References: <uu54la$3su5b$6@dont-email.me> <87edbtz43p.fsf@tudado.org> <0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk> <uusur7$2hm6p$1@dont-email.me> <vdf096$2c9hb$8@dont-email.me> <87a5fdj7f2.fsf@doppelsaurus.mobileactivedefense.com> <ve83q2$33dfe$1@dont-email.me> <87wmighu4i.fsf@doppelsaurus.mobileactivedefense.com> <ve8s6d$3725r$1@dont-email.me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net kPkG+M8jTWvFhtlyR2Oyog7P+ZQ8LCIhOhJH2kA0NQx5lapTY= Cancel-Lock: sha1:Qwl05E45mJZRMsRplIbsffdA8qo= sha1:pjD41EsyLt8VfHDIxtsPK/JVQx8= sha256:mddXLdLxyMsbpuR7KaMvdGpsKRFudO8Vl0ugDRqnfk0= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Bytes: 3669 Muttley@DastartdlyHQ.org ignorantly rambled: > On Thu, 10 Oct 2024 16:09:49 +0100 > Rainer Weikusat <rweikusat@talktalk.net> boring babbled: >>Muttley@DastartdlyHQ.org writes: >>> Its syntax is also a horrific mess. >> >>Which means precisely what? > > Far too much pointless punctuation. An interpreter shouldn't need the vartype > signified by $ or @ once its defined, it should already know. For the purpose of variable declaration, how's the interpeter going to know the type of a variable without being told about it? Obviously, not at all. Perl has three builtin types, scalars, arrays and hashes and each is denoted by a single-letter prefix which effectively creates three different variable namespaces, one for each type. That's often convenient, because the same name can be reused for a variable of a different type, eg: my ($data, @data, %data); $data = rand(128); @data = ($data, $data + 1); %data = map { $_, 15 } @data; it's also convenient to type and easy to read due to being concise. Outside of declarations, $ and @ really denote access modes/ contexts, with $ standing for "a thing" and @ for "a number of things", eg $a[0] is the first element of the array @a and @a[-3 .. -1] is a list composed of the three last elements of @a. > And then there are semantically meaningful underscores (seriously?) Similar to the number writing convention in English: 1,600,700, numbers in Perl can be annotated with _-separators to make them easier to read. Eg, all of these are identical 1_600_700 16_007_00 1_6_0_0_7_0_0_ But the underscores have no meaning in here. > and random hacky keywords such as <STDIN>. <STDIN> isn't a keyword. STDIN is the name of a glob (symbol table entry) in the symbol table of the package main. It's most prominent use is (as they name may suggest) to provide access to "the standard input stream". <> is an I/O operator. It's operand must be a file handle, ie, either the name of glob with a file handle associated with it like STDIN or a scalar variable used to hold a file handle. In scalar context, it reads and returns the next line read from this file handle. In list context, it returns all lines in the file. Eg, this a poor man's implementation of cat: perl -e 'open($fh, $_) and print <$fh> for @ARGV' > I could go on. Please don't enumerate everything else on this planet you also don't really understand as that's probably going to become a huge list. ;-)