Re: Larry Wall Talks, Perl and Lua (Was: Programming is hard, let's go scripting)

I've read Larry's article with that comparison between programming languages and natural languages, and I agree with him, but I'd have some more to add.

There are at least 2 kind of people who learn new natural languages. There are those with a very good memory that find it very easy to learn new and new natural languages, even if it doesn't help them that they know so many languages, because maybe they don't read books or travel much in foreign countries. But if it is so simple to do it...

And there are those who need to learn a new natural language because they really need it to be able to read books because they couldn't find them in their native language, or because they need to travel much, or because they have business relations with foreigners or something like that. Well, I guess most of those who learn a new natural language are from the second category, and when they choose to learn a certain language, most of them would probably choose the most successful language, which for the moment is english.
(I hope the US economy will end going down soon. :-)
It doesn't matter that the Japanese language is easier to learn than english in some respects, or the italian language is easier to learn than spanish. It does matter that the influence of the countries that have english as their official language is bigger in these times than the influence of other countries, even big countries like China.

And it is the same with the programming languages. If some languages and programming styles are promoted by big companies like Sun, IBM or Microsoft, those languages will have a bigger success because there will be more books printed for those languages, the editors would prefer to sell more books so they will also promote those languages, the teachers in schools and universities will find more teaching materials for those "powerful" languages than for other obscure ones, so finally there will be more programmers for those languages, and this will create a virtuous circle because more programmers will mean some more very good programmers that will really improve those languages.

Larry also use to talk about the democracy, and well, this is not ok, because as Metallica sings, "Freedom of speech is words that they will bend", so if we are not as good as Larry to make our own programming language, we need to use what others make, and when we choose, we are influenced by what the employers ask for.

Octavian

----- Original Message ----- From: "Veli-Pekka Tätilä" <vtatila@xxxxxxxxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, March 29, 2008 12:36 AM
Subject: Re: Larry Wall Talks, Perl and Lua (Was: Programming is hard, let's go scripting)


Octavian Rasnita wrote:
Read a nice article by Larry Wall at:
http://www.perl.com/pub/a/2007/12/06/soto-11.html
Hi Octavian,
And thanks for the post. I really like Larry's talks written down, even,
really smart, whitty and still serious talk, I'd say. Another Perl
article I like by him is this one about natural language principles:

http://www.wall.org/~larry/natural.html

I'm also beginning to like Lua very much based on this free Lua book:

http://www.lua.org/pil/

Dolphin chose it as their screen reader scripting language introduced in
CSUN I've heard and it will be properly publicized in the upcoming
V9.02. Very speech friendly and extremely minimalist, yet it is about as
flexible as Perl is in terms of functional programming and
object-orientation.

I learned about the Lua screen reader API, yet to be finalized, in an
experimental Dolphin course on using Lua in addition to the mapping
system they have, somewhat similar to WindowEye's set files.

Finally, to demonstrate, I decided to do the same task in Lua and Perl,
namely sorting BibTeX references by their citation key. The Perl version
is more functional, briefer and probably more idiomatic, but that's how
I code Perl. the Lua version, in turn, using a different strategy, is
much cleaner and maintainable by default. It doesn't have map or split,
though I've coded map from  scratch easily experimentally. And now the
code:

Perl version:

use strict; use warnings;
@ARGV == 2 or die "usage: inFile outFile\n";
($/, my %entries) = "";
open my $in, shift or die "Cannot read file: $^E\n";
/^@\w+\{(.+),/ and $entries{$1} = $_ for <$in>;
open my $out, ">", shift or die "Cannot write file: $^E\n";
print $out $entries{$_} for sort keys %entries

Lua version:

require "strict"
if not # arg == 2 then error "Usage: inFile outFile" end
local entries, sortedEntries, thisEntry = { }, { },  ""
for line in io.lines( arg[1] ) do
  local ref = string.match(line, "@%w+%s*%{(%w+)")
   if ref then thisEntry = ref end
   if not entries[thisEntry] then entries[thisEntry] = { } end
   table.insert(entries[thisEntry], line)
end
for entry in pairs(entries) do table.insert(sortedEntries, entry) end
table.sort(sortedEntries)
local outFile = io.open( arg[2], "w")
for _, entry in ipairs(sortedEntries) do
  for _, line in ipairs(entries[entry] ) do outFile:write(line, "\n")
end
end

Of course, you could do the Lua version in Perl. And since Perl has
proper arrays where as Lua arrays are just fast indexed hashes with int
keys, the PErl version might be more natural. Also, Perl autovivifies
arrays on indexing ($f{bar}[5] creates the hash and creates the array in
it), avoiding yet another if.

The key difference is not so much on what is possible but what the
coding culture says. The perl version is natural in Perl and the LUa
version is natural in Lua. Both are equally valid. The lua version is
easier to understand, though, and Lua is about as speech friendly as
Ruby is at best. The same is not true of Perl, though it seems to me
Perl 6 will rectify this partly.

I think the Lua object system is just plain clean and simple. The same
minimalism as in Perl but using only meta tables, not language magic
like @ISA and bless or library magic, such as overload.pm.

Finally, as for funny LArry quotes that make a good fortune file, here's
a list for you:

http://en.wikiquote.org/wiki/Larry_Wall

--
With kind regards Veli-Pekka Tätilä (vtatila@xxxxxxxxxxxxxxxxxxxx)
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at http://www.freelists.org/list/programmingblind

Other related posts: