Squirrel

The programming language
Welcome to Squirrel Sign in | Join | Help
in Search

Squirrel 3.0 alpha 1 released

Last post 08-10-2008, 7:33 AM by b34r. 13 replies.
Sort Posts: Previous Next
  •  07-23-2008, 10:31 AM 2645

    Squirrel 3.0 alpha 1 released

    I've just uploaded Squirrel 3.0 alpha 1 . The documentation is updated but I could have missed something.

    Feedback is welcome.

    Here is the link:

    https://sourceforge.net/project/showfiles.php?group_id=85893&package_id=285180&release_id=615255

    Here is the change log from 2.x :

    -first banch from 2.x source tree
    -added 'base' keyword
    -removed 'delegate' keyword
    -now compiled scripts are vararg functions
    -added setdelegate() and getdelegate() table builtin methods
    -added <=> 3 ways compare operator
    -added lambda expression @(a,b) a + b
    -added local function statement
    -added array built-in map(),reduce(),apply(),filter() and find()
    -generators hold only a weak reference of the enviroment object
    -removed 'vargv' and 'vargc' keywords
    -now var args are passed as an array called vargv(as a paramter)
    -removed 'parent' keyword
    -added class getbase() built in method
    -instanceof doesn't throw an exception if the left expression is not a class
    -lexical scoping for free variables(free variables are no longer in the second parameter list)
    -sq_setprintfunc accept error func
    -sq_geterrorfunc()
    -added sq_arrayremove() and sq_arrayinsert()
    -error() built in function(works like print but prints using the errorfunc)
    -added native debug hook

    ciao

    Alberto

  •  07-23-2008, 1:03 PM 2646 in reply to 2645

    Re: Squirrel 3.0 alpha 1 released

    On Unix (or GNU/Linux, actually), all the files have no read/write/execute permissions so I have to chmod +rw or chmod +rwx (for directories) on the files in order to be able to build.  Not a big issue, just small annoyance.
  •  07-24-2008, 6:15 AM 2647 in reply to 2646

    Re: Squirrel 3.0 alpha 1 released

    Is this a problem of this release or has always been so? because I haven't changed my build script in 5 years.

    ciao

    Alberto

  •  07-24-2008, 6:18 AM 2648 in reply to 2645

    Re: Squirrel 3.0 alpha 1 released

    Great to see this, here's a few notes:

    - The sq_setnativedebughook is missing from squirrel.h

    - At sqapi.cpp, line 105, it shouldn't be "v->_debughook = hook?true:false;"  ?
    - I also added a else v->_debughook = true; below line 116

    - At sqobject.h, line 81, I think it's better to change to "(--unval.pRefCounted->_uiRef)==0", since _uiRef is a unsigned integer it will never be less than zero


    Cya
  •  07-24-2008, 10:19 AM 2649 in reply to 2647

    Re: Squirrel 3.0 alpha 1 released

    I did not see this problem in earlier releases, or in the pre-alpha Version 3 release tar file.

    fagiano:

    Is this a problem of this release or has always been so? because I haven't changed my build script in 5 years.

    ciao

    Alberto

  •  07-25-2008, 1:01 AM 2650 in reply to 2649

    Re: Squirrel 3.0 alpha 1 released

    atai: Ok, i'll investigate, thx.

    Capyvara: Thanks for the bug report.

    Alberto

  •  07-29-2008, 8:21 AM 2656 in reply to 2645

    Re: Squirrel 3.0 alpha 1 released

    fagiano:

    -added sq_arrayremove() and sq_arrayinsert()



    Those functions seem to be missing from the squirrel header.

    What about removing the clone keyword and adding it as a built in method like you did with delegate?

    PS: This forum software sucks... :(
  •  07-30-2008, 12:18 PM 2665 in reply to 2656

    Re: Squirrel 3.0 alpha 1 released

    Check again, I pretty sure those functions are there.

    about clone I'll think about it.

    Alberto

  •  07-31-2008, 1:18 AM 2666 in reply to 2665

    Re: Squirrel 3.0 alpha 1 released

    You were right. For some reason I confused it with the 3.0 pre-alpha (they were both in the same folder). Sorry for that.
  •  07-31-2008, 2:07 AM 2667 in reply to 2666

    Re: Squirrel 3.0 alpha 1 released

    Another thing:
    gcc4 spits out various compiler warnings.

    At sqopcodes.h, line 83, there is a comma at the end of the enum list.
    At sqarray.h, line 75, you cast a SQUnsignedInteger to a SQInteger, to compare it to a SQUnsignedInteger. Whats the reason for this? You just loose accuracy.

    Change

    if(idx < 0 || idx >= (SQInteger)_values.size())

    to:

    if(idx >= _values.size())

    idx will never be less than 0, neither will _values.size(), since both are unsigned.

    There are some other problems, I will look into them as soon as i get back.

  •  08-08-2008, 8:03 AM 2676 in reply to 2645

    Re: Squirrel 3.0 alpha 1 released

    Hi, nice to see Squirrel advancing.
    I'm hitting a strange issue with this new build.

    Some code we have used to work fine with Squirrel 2.2.1 but not anymore.
    What's concerning is that compilation error is silent and 90% of the code works but this used to work:

    class    A
    {
        var = 0;

        function    UseOfBaseClassVar()
        {
            var = 1;
            print("var = " + var);
        }
    }

    class    B extends A
    {
        function    IndirectUseOfBaseClassVar()
        {
            print("In B.IndirectUseOfBaseClassVar()");
            UseOfBaseClassVar();
        }
    }

    B_instance <- B;    // Note the missing parenthesis!
    B_instance.IndirectUseOfBaseClassVar();

    This code on Squirrel 3 will compile ok and execute ok up to the point of the assignation of var in A where the VM stops with a missing index 'var' error.

    I can solve this particular issue by going back through the (rather large) code base and making sure parenthesis are where they should be when instantiating classes but I'd rather be sure this is the correct fix.
    I feel like Squirrel should detect this kind of erroneous instantiation and give a compiler error but since I am not a pro at scripting languages that might be some wanted functionality instead.

    The Squirrel compiler also often lets missing semi-colon errors slip by that will often manifest themselves at runtime as unrelated issues.
    Replacing the last line of the problematic code above by: B_instance.IndirectUseOfBaseClassVar compiles fine and does not give any trouble at runtime, nothing happens only.
    The syntax is ok except for the missing semi-colon probably.

    Well, anyway, Squirrel is a great language so I hope these issues can be ironed out with time.

    PS: I am running VS2008 on Vista 32bit by the way.

  •  08-08-2008, 8:28 AM 2677 in reply to 2676

    Re: Squirrel 3.0 alpha 1 released

    Ok, it seems I have been too fast to post.
    The issue is somehow related but the instance giving me troubles is instantiated properly (no missing parenthesis). Besides, going through the Squirrel code I can see why it is giving the results I see.

    However I have the issue stated in my previous post in a similar configuration.
    I am trying to reproduce it properly on a single example with no success so far.
  •  08-09-2008, 4:22 PM 2680 in reply to 2676

    Re: Squirrel 3.0 alpha 1 released

    1)B_instance <- B;
    2)B_instance <- B();

    3)B_instance.IndirectUseOfBaseClassVar;
    4)B_instance.IndirectUseOfBaseClassVar();

    I don't see the issue, all the above expressions are both semantically and syntactically correct.

    1) assigns the class B(not the instance) in the new slot B_instance;

    2) creates an instance of B and and assigns it to B_instace

    3)fetches the function(static slot) IndirectUseOfBaseClassVar, this can seem usesless without an assignement but in squirrel fetching a variable can have side effects (for instance if is fetched though a _get metamethod).

    4)fetches the function(static slot) IndirectUseOfBaseClassVar and invokes it.

    semicolons are optionals in squirrel.

    I hope this helps

    Alberto

  •  08-10-2008, 7:33 AM 2684 in reply to 2680

    Re: Squirrel 3.0 alpha 1 released

    Thank you for the clarification. Indeed, it makes sense.
    I had no ideas that semicolons were optional in Squirrel, my bad.

    Anyway, I managed to identify and solve my problem:

    class A
    {
       var = 0;
       function dup()
       {
          var = 1;
       }
    }

    class    B extends A
    {
        function dup()
        {  // Just getting in the way... }

        function    IndirectUseOfBaseClassVar()
        {
            // Will produce missing index 'var' in 3.0 (and quite logically so...) but used to work ok in Squirrel 2.2.1.
            A.dup();
            // Working as expected in 3.0
            base.dup();
        }
    }


    I did not try this exact sample so I hope it is valid outside of my project code.
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems