[Tfug] Language choices

Stephen Hooper stephen.hooper at gmail.com
Sat Nov 4 19:59:17 MST 2006


On 11/4/06, Bexley Hall <bexley401 at yahoo.com> wrote:
> Hi, Stephen,
>
> Stephen Hooper <stephen.hooper at gmail.com> wrote:    Logo! Logo!
>
>   Ouch!  I hadn't even considered that!  :<  I guess I think Logo I think "turtles"
>   and not "processing".  I'll have to dig out my course notes to see for sure...
>

It is a LISP derivative, so you should pretty much be able to do
anything in it...

>   I also deleted your "bullsh*t" email (Yahoo is intolerant of snafu's on my part).
>   But, from memory...
>
>   APL actually isn't terribly bad when it comes to punctuation.  The problem is
>   you need an APL typeball to use it!  :-/  If you replaced the symbols with
>   ASCII tokens, it wouldn't be bad at all.  (though crappy for my needs!)
>

Is your complaint with non alphabetic characters?  In that case, you
could argue the same thing about any language:

' 	( 	) 	+ 	, 	- 	. 	/ 	 : 	 ; 	< 	= 	> 	 ? 	[ 	]
\ 	_ 	¨ 	¯ 	× 	÷ 	← 	↑ 	→ 	↓ 	∆ 	∇ 	∘ 	∣ 	∧ 	∨
∩ 	∪ 	∼ 	≠ 	≤ 	≥ 	≬ 	⊂ 	⊃ 	⌈ 	⌊ 	⊤ 	⊥ 	⋆ 	⌶ 	⌷
⌸ 	⌹ 	⌺ 	⌻ 	⌼ 	⌽ 	⌾ 	⌿ 	⍀ 	⍁ 	⍂ 	⍃ 	⍄ 	⍅ 	⍆ 	⍇
⍈ 	⍉ 	⍊ 	⍋ 	⍌ 	⍍ 	⍎ 	⍏ 	⍐ 	⍑ 	⍒ 	⍓ 	⍔ 	⍕ 	⍖ 	⍗
⍘ 	⍙ 	⍚ 	⍛ 	⍜ 	⍝ 	⍞ 	⍟ 	⍠ 	⍡ 	⍢ 	⍣ 	⍤ 	⍥ 	⍦ 	⍧
⍨ 	⍩ 	⍪ 	⍫ 	⍬ 	⍭ 	⍮ 	⍯ 	⍰ 	⍱ 	⍲ 	⍳ 	⍴ 	⍵ 	⍶ 	⍷
⍸ 	⍹ 	⍺ 	⎕ 	○

From the wikipedia article.

>   As for my "new languages" use more punctuation...
>
>   Summary of operators -- as best as I can remember  :>
> (arbitrarily chosing to ignore decimal points in numeric
> values *and* all characters within strings; I also ignored
> mundane things like how lines are continued -- as well
> as any JCL required to *run* particular programs, etc.)
>   Note that I just list punctuation in the order in which
> I *remember* it.  And, I don't consistently mimic the
> order of earlier languages in subsequent presentations.
> (e.g., Modula2's alternation operator is listed AS IF it
> was a logical operator).
>   This isn't meant to be a comprehensive/scientific analysis;
> just something to get a quantitative *feel* for the various
> assortments of punctuation/operators in languages.  But, it
> is amusing to compare the amount of cruft in, e.g. Perl or Java,
> vs. "older" languages...
>
> ASM (VAX -- including macro capabilities)
>   a=b a=. a+b a-b a*b a/b
> label:
> .directive
> @pointer
> (address) (address)+ -(address)
> @(rn)+
> (rn)[rm]
> <expression>
> $macro
> ?parameter
> a,b
> ; comment
> #constant
> /string/ "string"
> ^Bbinary  etc.

Yeah... but machine doesn't have any punctuation.  Put a different
way, you are way off in orange land, trying to find apples :)

>
>   (Dartmouth) BASIC
>   -a +a
> a+b a-b a*b a/b a^b a,b
> a=b a>b a>=b a<b a<=b a<>b
> stringtype$
> "string"
> function()
> array(b)
> (expression)
> PRINT;
>

I think you are now not arguing non-alphabetic (or punctuation
characters), as you have parentheses, minus sign, etc. listed twice.

>   C++
>   +a -a ~a !a &a *a
> a+b a-b a*b a/b a%b a>>b a<<b a&b a|b a^b
> a++ ++a a-- --a
> a+=b a-=b a*=b a/=b a%=b a>>=b a<<=b a&=b a|=b a^=b
> a=b a==b a!=b a>b a>=b a<b a<=b
> a&&b a||b a.b a->b a:b a,b a::b
> a?b:c
> 'a' "a" '\a' \0a (significant leading zero)  \xDEADBEEF
> case:  statement;
> /* comment */   // comment
> function()
> function(...)
> (expression)
> a[b]  "a_string"[b]  (you "read" this differently than a[b])
> #define  (well, it's technically the preprocessor, but...)
> { block }
> plus all the overloading allowed (which increases instances of symbols)
>

So now we are into symbols?    I thought you wanted something with the
least amount of "punctuation" characters so that it could be read to
you over the phone.


>   FORTRAN
>   a=b a+b a-b a*b a/b a**b a,b
> .relop.  .logop.  (I think later versions allowed >, <, >=, etc.)
> function()
> (expression)
> *comment   (though '*' could have been 'C' to eliminate punctuation)
>
>   Java (same as C++, more-or-less, plus:)
>   id$ent_ifier (including unicode characters!)
> \uUNICODE
> a>>>b a>>>=b
>
>   Limbo (much like C with a few additions and changes)
>   RADIXrVALUE
> \uUNICODE
> #comment
> iden_tifier   (including unicode characters)
> 'a' '\a' "string"
> a:=b a<-b a=>b a:b
> string[from:to]
> no &a allowed
> no a?b:c
> different a::b semantics
> different comment syntax:  #comment
> different function(...) syntax:  function(*)
> different "preprocessor" syntax
> different switch/case syntax
>
>   LISP
>   () () () () () () () () () () () () () () () () () () () () () () ()
> + - x / ' ` < >
> LET*  #'
>
>   Modula-2
>   +a -a ~a a^
> a+b a-b a*b a/b a&b a|b a:=b a.b a,b
> a=b a#b a<>b a>b a>=b a<b a<=b
> "a" 'a'
> case:  statement;statement
> (* comment *)
> function()
> (expression)
> array[b]  array[a..b]
> {set}
>
>   Pascal
>   +a -a a^ ^a
> a+b a-b a*b a/b a:=b a.b a,b a:b a..b
> a=b a<>b a>b a>=b a<b a<=b
> a;
> statement;statement
> {comment}  (*comment*)
> 'string
> function()
> (expression)
> array[b]
>
>   PL/1
>   i_de#nti$fie at r
> 'string'
> -a +a ~a
> a+b a-b a*b a/b a**b a||b a&b a|b a,b a->b
> a=b a<b a<=b a>b a>=b a~<b a~>b a~=b
> statement;
> /*comment*/
> %preprocessor
> function()
> array(b)
> (expression)
>
>   PL/M
>   -a +a
> a+b a-b a*b a/b a=b a,b a.b
> a<b a<=b a>b a>=b a<>b
> function()
> array(b)
> (expression)
> iden$tifier
> statement;   label:
> 'literal'
> .(location)
> $INCLUDE
> /*comment*/
>
>   REXX
>   i_de$nt?ifie!r
> 'a'  "string"
> function()
> +a -a ~a
> a+b a-b a*b a/b a//b a%b a**b a||b a&b a|b a^b a&&b a.b a,b
> a<b a<=b a>b a>=b a~<b a~>b a==b a~=b a~==b a=b
> array(b)
> (expression)
> /*comment*/
> label:
>
>   SMALLTALK
>   RADIXrVALUE
> $character
> 'string'
> "comment"
> #symbol
> [block]
> :parameter
> +a -a ^returned
> a_b a+b a-b a*b a/b a//b a\\b a at b
> a<b a<=b a>b a>=b a~=b a==b a=b a~~b
> message:
> |temporary|
> (expression)
>
>   SNOBOL ("4", I think)
>   iden.ti_fier
> 'string'   "string"
> +a -a $a ~a ?a @a .a
> a+b a-b a*b a/b a!b a**b a|b a.b a$b a=b a,b
> (expression)
> :F(label)   :S(label)   :(label)
> function()
> &keyword
> ARRAY(b)   array<b>
> *comment
>
>   PERL
>   $scalar  &subroutine  @array  *glob  %hash
> "string"  `command`  /pattern/  ?PATTERN?  (list)  {block}  <STDIN>  <>
> +a -a !a a++ ++a a-- --a \a <<a $#a a?b:c
> -e -r -w -d -f -T (file test operators)
> a+b a-b a*b a/b a%b a>>b a<<b a&b a|b a^b a**b axb a,b a.b
> a+=b a-=b a*=b a/=b a%=b a>>=b a<<=b a&=b a|=b a^=b a**=b a.=b ax=b
> a=b a==b a!=b a>b a>=b a<b a<=b a<=>b a=>b
> a&&b a||b a&&=b a||=b a=~b a!~b a->b a->[b] a{b} a..b a::b
> $& $` $' $+ $* $| $% $= $- $~ $^ $_ $. $/ $, $\ $" $; $: $? $! $@ $$ $< $> etc.
> statement;   label:
> array[b]  function()
> plus a littany of regex pattern characters, backreferences, assertions,
> magic variables/constants, etc.  (?= ?! ...) ("KitchenSink")
>
>
>   <shrug>  When you look at BASIC, FORTRAN, PL/1, etc. they really *do*
>   look a lot "cleaner" in this regard, eh?
>

If by cleaner you mean that they will have less punctuation per line,
then yes, I guess they might.  I would also argue that if you are just
looking at punctuation characters that will be present in any given
code listing you will find that there is pretty much the same number
in most languages.

It is true that you may end up cramming more on a line in Perl for
example than in BASIC.

For example, do this in BASIC:

Create  a hash.
Now put a value tied to key "foo" in that hash.
Now retrieve and display  "foo" from the hash.

In "good" perl (by which I mean Perl as I write it :)):

my(%hash);
$hash{"foo"}  = 100;
print("${hash{'foo'}}\n");

So let's count the punctuation:

(%);  -- four
${"}= --five -- "; makes it seven
'\ -- two -- ("${{'}}"); makes it eleven

Eleven non alphabetic symbols in the code.  If you want to count each
instance then I come up with 22 non-alphabetic symbols.

Now write the same thing in BASIC...  I am betting you will come up
close to the same number of  punctuation marks that I just came up
with.  It is a very finite set, and so you are not going to see a
discrepancy over 26 (as I count them)... No matter which dialect you
use.

I would further hypothesize that total number of punctuation marks may
be either much higher, or pretty much the same.

So... why do you think it reads cleaner?

 Look at the total number of characters in your code block, and then
look at that total number of punctuation characters,  divide it by the
first, and get a percentage.

My guess is you will find some old languages (such as APL, LISP) will
have the higher percentages of punctuation as to what you are
referring to as "new" languages (Python, Perl, Ruby).

You will probably find too that some old languages such as APL, have
more than 26 separate punctuation characters.   I don't think Perl
does.

If we were then to go on to argue the intent of use behind those
punctuation characters... for example in "C": > vs. >> (two completely
different things), I think you will find that Perl has pretty much the
same as "C" with the addition of the "shell-isms".  Not too familiar
with Fortran.

But (again to hypothesize),  LISP, with the probably the lowest count
of interpretable punctuation characters probably has the highest
percentage of characters that mean two different things depending on
context.  That would be because if, for example "+" means "plus"
(which does depend on the LISP dialect), and it also means "positive"
then you are in essence using the  symbol with two different meanings,
and because LISP has less punctuation characters that can be
interpreted, the percentage of such two-faced symbols must be higher.

The point of that hypothesis?  Well... I could argue that looking at
your lists above that you are not arguing a single facet of a language
(such as how many punctuation characters it has in it), but that you
are arguing that the use of punctuation characters in the language
makes it somehow less "readable" (over the phone?) because of the
variety  of things that punctuation characters may be used for.

To sum up, I still think your statement was  (unexamined (bullsh*t)),
no matter which way you look at things :)

But, maybe I lost sight of the discussion...

<aside>

I wasn't meaning to be insulting, just that I sometimes say stupid
things without thinking about them very much either: like, "Why is
that we are putting cameras on cell phones?  They used to work fine
without them...", and I always appreciate being called on that kind of
thing.

If nothing else, it shows me that I have not drunk enough to be truly
all knowing.
</aside>


More information about the tfug mailing list