Related articles |
---|
[ANN] Squirrel yet another scripting language albertodemichelis@hotmail.com (2003-09-09) |
Re: [ANN] Squirrel yet another scripting language visionary25@hotmail.com (Vis Mike) (2003-09-14) |
Re: [ANN] Squirrel yet another scripting language me@here.there.com (Peter Ashford) (2003-09-22) |
Re: [ANN] Squirrel yet another scripting language emonk@slingshot.co.nz (Corey Murtagh) (2003-09-22) |
Re: [ANN] Squirrel yet another scripting language nmm1@cus.cam.ac.uk (2003-09-23) |
Re: [ANN] Squirrel yet another scripting language joachim.durchholz@web.de (Joachim Durchholz) (2003-09-23) |
Re: [ANN] Squirrel yet another scripting language vbdis@aol.com (2003-09-27) |
Re: [ANN] Squirrel yet another scripting language visionary25@hotmail.com (Vis Mike) (2003-09-27) |
From: | Corey Murtagh <emonk@slingshot.co.nz> |
Newsgroups: | comp.compilers,comp.games.development.programming.misc |
Date: | 22 Sep 2003 23:41:08 -0400 |
Organization: | Ye 'Ol Disorganized NNTPCache groupie |
References: | 03-09-048 03-09-053 |
Keywords: | design, comment |
Posted-Date: | 22 Sep 2003 23:41:08 EDT |
Vis Mike wrote:
> "Alberto" <albertodemichelis@hotmail.com> wrote in message
>
>>Squirrel is a high level imperative/OO programming language, designed
>>to be a powerful scripting tool that fits in the size, memory
>>bandwidth, and real-time requirements of applications like games.
>>Although Squirrel offers a wide range of features like:
<snip>
>
> Looks a bit like NewtonScript / JavaScript. I have to ask why you chose C
> style loops instead of something like:
>
> for i in 1..10 { } or something similar. C style loops are so cryptic.
C-style for statements are very easy to parse, if the language is at
all C-like, and very powerful. Although they /can/ be cryptic, they
are also more versatile than simple indexed for statments. Also, for
a C or C++ programmer - or a Java one even - having a C-style for
statement seems logical.
A C-style for statement can be expressed as a while statement trivially:
for (init_expr; test_expr; increment_expr)
statements;
equates to:
init_expr;
while (test_expr)
{
statements;
increment_expr;
}
The only even slightly tricky part is that the test expression defaults
to true. So:
for (;;)
statements;
equates to:
while (true)
statements;
Cryptic maybe, depending on the way the programmer uses it, but not
exactly difficult.
--
Corey Murtagh
The Electric Monk
[I think this is enough language syntax theology for this week. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.