Re: Write Fortran in Ruby

Try to write the following Fortran 77 program (note the
6 space indentation) in Ruby so that it looks as close
to the Fortran as possible without extending Ruby:

  program ii
  integer i
  do i=0,10
     print*,i
     if (i.gt.5) goto 1
  enddo

1 print*,i*i
end

Here’s the Python candidate to date:

for i in range(10):
#begin
print i
if i>5: break
#end
print i*i


Better Python candidate…

 from operator import gt
 class goto1: pass
 try:
  for i in range(0,10):
   print i
   if gt(i,5): raise goto1
  #endfor
 except goto1: pass
 finally:
  print i*i
 #end

But why is anyone trying to convince a fortran programmer to use a slow,
dynamic language? This reminds me: Too many of the language debates
concentrate on static vs. dynamic typing. The real issue is type
declarations. They waste time during proto-typing. But there is another
way
to eliminate those pesky declarations: type-inferencing.

People are spending a lot of time trying to “optimize” Ruby, Python, and
Perl. They’re all hitting the same problem: dynamic typing. It’s
insurmountable. I was really hoping that Ruby could be THE language, but
last night, browsing the Great Language Shootout page, I noticed a
problem:
Ruby is SLOW! Even compared to Python.

Boo and Ocaml are examples of fast, agile languages, and if more
companies
would adopt them, I’d switch in a heartbeat.

On Fri, 3 Mar 2006, Christopher Dunn wrote:

1 print*,i*i

except goto1: pass

People are spending a lot of time trying to “optimize” Ruby, Python, and
Perl. They’re all hitting the same problem: dynamic typing. It’s
insurmountable. I was really hoping that Ruby could be THE language, but
last night, browsing the Great Language Shootout page, I noticed a problem:
Ruby is SLOW! Even compared to Python.

i’ve never had a problem with this and am routinely process files
ranging from
40mb to 3gb - one only has to use c extensions.

why do you see dynamic typing as a contributor to slowdown?

Boo and Ocaml are examples of fast, agile languages, and if more companies
would adopt them, I’d switch in a heartbeat.

ocaml is very good - but it’s a massive paradigm shift for most people’s
thought train… most real world problems are imperitive.

-a