Archived

This topic is now archived and is closed to further replies.

[ANN] Squirrel 1.0 beta 2 released

This topic is 4980 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Squirrel 1.0 beta 2 has been released: The release fiexes some minor bug in the the parser and adds several new features in the C API. "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: dynamic typing,delegation,higher order functions,generators,coroutines, tail recursion ,exception handling ,automatic memory management and both compiler and virtual machine fit together in about 6k lines of C++ code. [released under zlib/pnglib licence]" http://squirrel.sourceforge.net ----------------------------- The programming language Squirrel http://squirrel.sourceforge.net

Share this post


Link to post
Share on other sites
What''s differences between Squirrel and LUA?? I''ve looked at the site and some of the documentation and it looks very similar. What would make me want to pick this language over LUA. Sell it to me.

Denny.

Share this post


Link to post
Share on other sites
Well, squirrel and lua are surely the same category. I started designing squirrel while I was developing a game massively lua based(farcry). I started trying to do a refcounted lua but after I decided to create a brand new thing. I tried to change the aspects that were not really fitting my needs.
Still, there are quite a bit of semantic differences between squirrel and lua.

They main differences are:
-Squirrel has C-like syntax, in my prev team I realized designers were more confident with C syntax because most of them dealed with JavaScript making web pages. Lua as pascalish syntax.
-Squirrel is reference counted and has a determintistic garbage collector that can be called on demand to resolve cycles, but usually is not needed. Lua uses a mark and sweep GC.
-Squirrel has arrays as primary type, lua doesn't.
-Squirrel has integers and floats as separated types, for that also supports all bit manypulation C operators. Lua has only floats and no bit manypulation.
-In Lua is not possible to determinate if a table field doesn't exists or si 'nil', fields are created through the normal assignment operator = , so if you mistype a name you end up having a new variable you are not aware of. In Squirrel a table fiels is created through a the operator <- and deleted with the keyword 'delete'. This applies also to global variables.(no variable is created if someone mistype a filed name, an exception is thrown instead).
-Squirrel has built in delegation(sort of prototype based inheritance). Lua has a metatables and the "index" method.
-Squirrel has different scoping rules, there is not need for the 'self' in front of every table field etc... and you have to put ::varname to access globals explicitly. Lua requires the self.field and the rest is global.
-Squirrel implements generators(kinda light weight coroutines) and heavy duty coroutines. Lua has only coroutines.
-Squirrel types have default methods like array.append(), array.sort(). Lua uses a global api.
-Squirrel has exception handling(try/catch). Lua doesn't.
-Squirrel supports Unicode. Lua ascii only.
-According to some old benchmark I did squirrel is faster for certain stuff lua is faster for other. but the difference is minimal.(I have to make a new benchmark)

There are many other more subtle differences, but I would have to write a book to explain them all. Take a look at the squirrel manual on the website.

API wise they are similar but not quite the same.

ciao
Alberto

-----------------------------
The programming language Squirrel
http://squirrel.sourceforge.net




[edited by - fagiano on April 21, 2004 3:24:37 PM]

Share this post


Link to post
Share on other sites
Going once, going twice... I''m just about sold on Squirrel. So far sounds like it''s got pretty much everything I''ve been looking for in a Scripting Language.

If I may comment on your website though.. you really should setup a Forum on your site, as opposed to just a Yahoo mailing list, for support and user interaction.

It''d also be nice to see some kind of area for tutorials.. that''s one thing a lot of newer scripting languages are terribly short on. Maybe a Wiki or something, I dunno.

****************************************

Brian Lacy
ForeverDream Studios

Comments? Questions? Curious?


"I create. Therefore I am."

Share this post


Link to post
Share on other sites
Yep, I should probably set up a forum, good call(any suggestion on a good php based Furum engine?). Regarding tutorials, it was already in my plans, I din''t do it yet because I was still refining the API but probably now is time ot do it.
I was actually thinking about writing an article on how to set up a complete scripting architecture based on squirrel. The fact is that at the moment I''m on my own, so everything is stricly related on the amount of spare time I have.

thx
Alberto

-----------------------------
The programming language Squirrel
http://squirrel.sourceforge.net

Share this post


Link to post
Share on other sites
Sounds very interesting. Just one question though: Does the userdata work the same way as in Lua meaning do you also have to create a meta table to access the members and methods for a class? That wasn''t very clear in the manual.

Share this post


Link to post
Share on other sites
Yes, userdata more or less work like in lua. In squirrel is actually simpler, you can still use _set and _get but is easyer to place the methods directly in the userdata's delegate(equivalent to lua's metatable). If you put the methods in the delegate there are no performance penalties of calling _set/_get metamethods. With metamethods you can also allow to iterate your userdata contents with 'foreach' and override operators.


the following sample uses a table but applies also to userdata


local table = {
test = "I'm a test"
}
local thedelegate = {
function dostuff(a)
{
::print(test+" "+a);
}
}

table = delegate thedelegate : table;

table.dostuff("ciao")

//prints "I'm a test ciao"




Alberto

PS: I've created a forum on th website, I'll activate it soon; any suggestion about how to organize forums categories?


-----------------------------
The programming language Squirrel
http://squirrel.sourceforge.net



[edited by - fagiano on April 22, 2004 7:46:06 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by fagiano
Yep, I should probably set up a forum, good call(any suggestion on a good php based Furum engine?). Regarding tutorials, it was already in my plans, I din''t do it yet because I was still refining the API but probably now is time ot do it.
I think with an easily accessible forum setup (i.e. allowing guest access as GameDev does), people will be much more likely to flock to your project. People tend to get involved most easily when it is easy to communicate with the person(s) at the head of the project.

As for forum software, I always recommend (with great praise) the new SimpleMachines Forum (SMF) from the developers of YaBB SE. I won''t plug it more than that in the middle of your Squirrel Script thread, though.

****************************************

Brian Lacy
ForeverDream Studios

Comments? Questions? Curious?


"I create. Therefore I am."

Share this post


Link to post
Share on other sites
In Squirel, can I run the script for n intructions? sort of how SEER does it? I mean, can I run half a script, then do some stuff in the host program and then run the other half of the script? and do this every frame. like RunScript( 10 ); will run 10 instructions then return?

Denny.

Share this post


Link to post
Share on other sites
The forum is up:
http://squirrel.sourceforge.net/forum/

irbrian: sorry but I had installed the forum around 1h after you gave me the idea. I think the one I''ve found is quite good. thx in any case.

brain21: no, squirrel cannot suspend the VM execution based on the numebr of instructions executed. Like lua uses coroutines, you can suspend the execution calling the function suspend().

all: if you have any other questions, use the brand new forum

ciao
Alberto


-----------------------------
The programming language Squirrel
http://squirrel.sourceforge.net

Share this post


Link to post
Share on other sites
Squirrel is pretty nice I like what you have done, it compiled without any problems and works great (except that programming in the REPL was a bit awkward). There are some features of the language I haven''t quite figured out yet though but I guess eventually they will make sense :-) Since I never really dug into Lua much I guess it is why I don''t get some of the features.

I wish I had known about your project sooner, but I don''t feel like I wasted my time working on my own stuff. It is very good practice. Maybe I will eventually help out and we can build a translator in the backend to translate Squirrel code to C++ or C and compile native modules to link into the VM. Your code was pretty good (but I dare say, use more whitespace. It is nearly as terse as a Scheme program! :-)

Peace->

Share this post


Link to post
Share on other sites
Thx PeterTarkus

quote:

Squirrel is pretty nice I like what you have done, it compiled without any problems and works great (except that programming in the REPL was a bit awkward).



the REPL progamming style is there to avoid the user to deal with objects ownership. As far as the objects is in the stack you do not have to worry about who owns what(try to embed python and you''ll understand). Plus in this way the API maps almost 1:1 on the VM so most of the functions directly kick into VM code. That''s faster and avoids reduntant code.

quote:

Maybe I will eventually help out and we can build a translator in the backend to translate Squirrel code to C++ or C and compile native modules to link into the VM



That would be great thx. I''d like to offer more tools for squirrel, is just that I really can''t find the time. Expecially because at the moment I''m focusing on making the core language polished and rock solid.

quote:

Your code was pretty good (but I dare say, use more whitespace. It is nearly as terse as a Scheme program! :-)



Indeed my coding style is a bit compressed The main reason is that initially squirrel wasn''t ment to be released to the public, I was just experimenting. A collegue of mine convinced me to release it. I usually do not code like that in working environment only when I code for myself. I plan to do some reformatting.


-----------------------------
The programming language Squirrel
http://squirrel.sourceforge.net

Share this post


Link to post
Share on other sites
hehe, I was VERY much joking. I code equally as terse, in fact I am worse than you :-)

It is a great job you did I congratulate you and thanks for opening up your ideas as many people can learn and evolve from the techniques you presented and it should be very useful to people once it gets more tutorials and people contributing to it.

Peace->out

Share this post


Link to post
Share on other sites
I am not sure if you are interested but I worked out a scheme to call C functions directly from an interpreter environment.

For instace a C function like

double fact(double a)
{
...
}

I can call them directly. It involved some magic and alot of assembler code. It is extremely fast though as the C function is ''raw'' and there is no need to get into the interpreter or anything.
It should be possible also to link them directly to DLLs and stuff too.

If you are interested in extending squirrel with something like that I can post the general code solution but you will have to work out the details into integrating it into squirrel. The only hard part is really managing the stack in C as you have to do some juggling between assembler and C code in between calling the function.

See yah

Share this post


Link to post
Share on other sites
Yep, I know the thecnique, I used to be into asm development. The guy that integrated squirrel in my company''s engine implemented something similar to automatically bind C++ virtual interfaces to squirrel. However don''t want to add any asm code in the core lang, is way to difficult to maintain and is not really portable. Squirrel is already fast enough for my pouposes. Maybe an external library like my collegue did, would be a better solution.

ciao
Alberto

-----------------------------
The programming language Squirrel
http://squirrel.sourceforge.net

Share this post


Link to post
Share on other sites