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

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



Jakub Travnik <J.Travnik@sh.cvut.cz> writes:

[...]

> 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.

ok, i remove them.

> 
> 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.

distinguishing mandatory spaces is not easy across languages

I thought about tagging non-mandatory spaces, but there are too many

about counting tokens:
- variables names are the same for each snippets, so no pb
- library function names difference in length can be quite important.
  should System.Console.WriteLine be considered as 1 token? 5 tokens?
  whereas scheme's "read-string!/partial" or "date->time-monotonic" be
  1 token ?

[...]

> 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

ok, i replace gcc with tcc

[...]

> 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).

I would say debuggers. A debugger with full REPL power is nice. 

how do people debug in python? do they really do 
% python /usr/lib/python2.2/pdb.py prog.py
??