[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



Ken Anderson <kanderson@bbn.com> writes:

> I like your approach, but i think it is weighted too much toward the
> empty expression, and "hello world" examples which aren't representative of
> scripts people write.

the "empty" is merely for calibrating the scoring,

and i do want to add more different things.

i wanted to split the various things needed in a script...

> How about something a little bigger, like writing something that could compile
> everything that needs compiling in a directory and it subdirectories.

something like this?

Dir['**/*.c'].each{|c|
  o = c.sub('\.c$', '.o')
  if !FileTest.exist?(o) || File.stat(o) <= File.stat(c) then
    puts "compiling #{c} to #{o}"
    system("gcc", "-c", "-o", o, c)
  end
}

there surely are interesting things here:
- replacing .c with .o (at the end)
- stat'ing files
- system
- simple formatted print
- looking for files in a hierarchy

- one could add a usage and argument handling

but do you think it's better having all this in one program? This will
make the comparison less precise. i've already put a "simple formatted
print" example, and a "system" example.