[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scriptometer: measuring the ease of SOP (Script OrientedProgramming) of programming languages



From: Pixel <pixel@mandrakesoft.com>
Subject: Scriptometer: measuring the ease of SOP (Script Oriented Programming) of programming languages
Date: 21 Sep 2002 02:14:49 +0200

> Additions, suggestions and comments welcome (including spelling,
> grammatical and stylistic corrections :)
> 

Note 1:

I see some bias in following code:

| sh        |a=1; b=2; echo "$a + $b = $[$a + $b]"                  |
|-----------+-------------------------------------------------------|
| Ruby      |a = 1; b = 2; puts "#{a} + #{b} = #{a+b}"              |
|-----------+-------------------------------------------------------|
| Perl      |$a = 1; $b = 2; print "$a + $b = ", $a + $b, "\n"      |

Why assignment in ruby and perl (and some others) have redundant spaces?
I'm just used to skip those in my code.

This leads me to other question: Can we sacrifice readability for size
in such comparison? Or we can measure number of language tokens
instead of characters (e.g. identifier count as one, brace count as
one, mandatory space count as one, ...)? I would prefer this kind
of counting.


Note 2:

There is C compiler that knows shebang and can do some form of bounds
checking. It is tcc.  It is targeted for scripting since program is
compiled directly to RAM memory without intermediate files (it cannot
compile to file). It is also very small, under 100K bytes.

Here is its description from debian package:

tcc - Tiny C Compiler - The Smallest ANSI C compiler

TCC (Tiny C Compiler) is small, fast, unlimited, and safe.  You can
compile and execute C code everywhere (e.g., on rescue disks).  It
generates optimized x86 code, and can compile, assemble, and link
several times faster than 'gcc -O0'.  Any C dynamic library can be
used directly.  It includes an optional memory and bounds checker, and
bounds-checked code can be mixed freely with standard code.  C script
is also supported--just add '#!/usr/bin/tcc' at the first line of your
C source, and execute it directly from the command line.


BTW: Shebang is 15 points and REPL 5 points in test.  I would honor
REPL more points than 5 since it affect way how scripts are developed
(especially when introspection is available, e.g. in ruby I use
method "methods" in IRB much when developing).

Best regards,

Jakub Travnik
jabber://jtra@jabber.com