Results 1 to 4 of 4

Thread: Script language features?

  1. #1
    Join Date
    Feb 2009
    Location
    Nebraska
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Script language features?

    I'm new to the scripting language, so I'm still exploring what it can do. As I write my first script I've noticed a few missing features and I wanted to see if I can confirm that and see if anyone has workarounds.

    It does not appear to support:

    Script-defined classes:
    Code:
    type
      TTest = object
      public
         TestMember: Integer;
      end;

    Default/Optional parameters:
    Code:
    procedure Foo(Bar: string ; Baz:Integer = 0);
    Method/Function overloading:
    Code:
    procedure Foo(Bar: string );
    procedure Foo(Bar: string ; Baz:Integer );
    Typed constants:
    Code:
    const
      Foo: Integer = 1;
    Nested functions
    Code:
    procedure Foo;
      procedure Bar;
      begin
      end;
    begin
    end;
    Local constants:
    Code:
    procedure Foo;
    const
      Bar = 'Baz';
    begin
    end;

  2. #2
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    const
    Foo: Integer = 1;
    You don't need to declare it as integer,
    it'll know it's one if you just do "foo = 1;"


    Local constants, got some use for them?

  3. #3
    Join Date
    Feb 2009
    Location
    Nebraska
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    You don't need to declare it as integer,
    it'll know it's one if you just do "foo = 1;"
    Typed constants are useful for defining standard sets.

    Code:
    type
      TSomeObjectEnum = ( soBones, soCoins, soMeat, soBeer );
      TSomeObjects = set of TSomeObjectEnum;
    
    const
      cCoinsNBeer : TSomeObjects = [soCoins, soBeer];
      cMeatNBones : TSomeObjects = [soMeat, soBones];
    
      // I didn't try this:
      cMeatNCoins = [soMeat, soCoins];
    
    procedure ObjectsToPickup( Objs: TSomeObjects );
    begin
    end;
    
    begin
      ObjectsToPickup( cCoinsNBeer );
    end.
    There are other ways and I didn't explore too deeply, maybe some variation of it will work.

    Local constants, got some use for them?
    I prefer not to have magic values in my code, so any time I'm using a constant value of some sort I give it a name and toss it into the local scope.

    Later I can easily pull local constants that ought to be moved into another location simply by searching for the const keyword in the code.

    I can get around this by use vars and initing them in the procedure body, but the fact that it is declared as a var implies to a reader that the value is in fact variable, and setting the value apart from the declaration just isn't very clean.

    To get around this I've just been putting the const section between the procedure comment header and the procedure keyword. This is clear, but doesn't limit the scope to the local routine, so consts show up in the code insight popup in places where they shouldn't.

  4. #4
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Unfortunately the engine doesn't support any of that.. can get quite annoying at times

    EDIT: You can overload only functions/procedures that SCAR includes by default. Ex. FindColor.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Gmails New Features
    By smithsps in forum The Bashing Club / BBQ Pit
    Replies: 3
    Last Post: 04-03-2008, 01:26 AM
  2. Help Addin in More Features
    By HanTu in forum OSR Help
    Replies: 3
    Last Post: 04-03-2007, 01:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •