lua-users home
lua-l archive

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


On Thursday 26 January 2006 11:13, Michael Abbott wrote:
[...]
> Logo wasn't as much a toy language as you may think.  I vaguely remember
> putting an Ironman style single player car racing game together.

Logo got a terrible press because the first implementations were on crappy 
8-bitters with not enough memory or CPU time to do anything useful; so all 
you got were toy programs using the turtle. The Logo core is, basically, Lisp 
with different syntax; it doesn't distinguish between code and data except 
internally. Everything's a list. This means it's easy to construct your own 
control structures by simply passing around lists of statements. Good old 
repeat:

repeat 4 [fd 100 lt 90]

...is an example of this. Logo has improved rather on Lisp's function 
definition rules which means it's now possible for a function to know how 
many arguments to take --- so you don't need gratuitous brackets everywhere 
--- but that also means that if you aren't anally retentive about whitespace 
and indenting you end up with incomprehensible lists of tokens that rival 
Forth for clarity.

(My first Logo was Acornsoft Logo on the BBC Micro. 2MHz 6502 with about 25kB 
of usable memory, and it had a Prolog implementation...)

Io is similar, but it represents all code as syntax trees, and a 'function' 
can opt whether to have its parameters evaluated at call time or to leave 
them unevaluated for use later... so it manages to get away without 
distinguishing between code to run now, and code to run later. The Logo 
example above would end up as something like:

repeat(4, fd(100) lt(90))

It's an interesting language, and deliberately compares itself against Lua in 
terms of speed and code density.
[...]
> Oh, and on the topic of adding braces to Lua, please don't!  I like
> languages like Python and Lua specifically because they read well.  It's
> such a welcome change from symbol heavy C/C++.  If you want a language
> with symbols everywhere you can always go Perl ;).

Incidentally, C-like languages have:

if (expression) statement else statement
where { statementlist } is a statement.

Lua has:

if expression then statementlist else statementlist end
where begin statementlist end is a statement.

The then...else...end in an if is a completely different syntactic concept 
from begin...end --- Lua's if *inherently* can cope with multiple statements, 
where C's if can't.

-- 
+- David Given --McQ-+ "There is one thing a man must do // Before his
|  dg@cowlark.com    | life is done; // Write two lines in APL // And make
| (dg@tao-group.com) | the buggers run."
+- www.cowlark.com --+ --- The Devil's DP Dictionary

Attachment: pgp5jVSj1U7x9.pgp
Description: PGP signature