Page 6 of 16 FirstFirst ... 45678 ... LastLast
Results 76 to 90 of 239

Thread: LScript "Wish List"

  1. #76
    Wish:

    Continuing from #75 post about optional parameters --
    Allow the create routine to be sent a parameter by adding a third parameter to ApplyServer.


    Prototype:

    Code:
            ApplyServer("ItemMotionHandler","vFollower",vFollowerParameters);
    And vFollower would be coded:

    Code:
    create: initParms {
    
         if (initParms)
            useTheInitParms(initParms);
         else
            a=0;    // or whatever
    }
    from the previous post, initParms would be set to nil when using the old style

    Code:
            ApplyServer("ItemMotionHandler","vFollower");


    similarly
    Code:
    generic: initParms { }
    Last edited by GregMalick; 12-01-2004 at 09:05 AM.

    Somewhere, over the rainbow....

  2. #77
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    Quote Originally Posted by GregMalick
    Wish:

    Modify UDF's so they can have optional parameters.
    prototype:

    Code:
    myUDF: x, y, z {
        info(x, "-", y, "-", z);
    }
    How about default values then?
    Code:
    myUDF: x, y="some string", z=1.0 {
        info(x, "-", y, "-", z);
    }
    Cheers,
    Mike

  3. #78
    Keeps getting better...I bet these aren't that bad to implement.

    Somewhere, over the rainbow....

  4. #79
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    Quote Originally Posted by GregMalick
    Keeps getting better...I bet these aren't that bad to implement.
    O.k., kick out LScript, use a C++ interpreter (with optional compiler) and get LW into a decent object oriented structure

    Cheers,
    Mike

  5. #80

    Talking

    Quote Originally Posted by Lightwolf
    O.k., kick out LScript, use a C++ interpreter (with optional compiler) and get LW into a decent object oriented structure

    Cheers,
    Mike
    Unfair! You're an obfuscated SDK hacker. Of course you want that.



    Seriously now,

    Code:
    allow the use of:
    
         Rotation().p
         Rotation().b
         Rotation().h
    
    instead of 
    
         Rotation().x
         Rotation().y
         Rotation().z
    for Clarity and Sanity's sake




    In case the above is not clear, I want p,b,h to be aliases for x,y,z when dealing with 3D vectors.
    So I can write code that accurately communicates what's going on. (fat chance!)
    Last edited by GregMalick; 12-01-2004 at 11:47 AM.

    Somewhere, over the rainbow....

  6. #81
    I am Jack's cold sweat Karmacop's Avatar
    Join Date
    Feb 2003
    Location
    Bathurst, NSW, Australia
    Posts
    2,117
    Can't you have multiple UDFs with the same name?

    eg

    myUDF: x, y, z {
    info(x, "-", y, "-", z);
    }

    myUDF: x, y {
    info(x, "-", y);
    }

    I don't even know what a UDF is really ... is it just a method/function? What does it return?

  7. #82

    Wink

    a UDF is a User Defined Function.
    You have headed into OO territory where appropriate functions can be determined by the parameters passed into them.
    That's a foundational design change to the Procedural approach LScript has.




    and you just wanted a yes or no.

    Somewhere, over the rainbow....

  8. #83
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    Quote Originally Posted by Karmacop
    Can't you have multiple UDFs with the same name?
    Well, that defeats the purpose of only coding the udf once now, doesn't it?

    Cheers,
    Mike

  9. #84
    I am Jack's cold sweat Karmacop's Avatar
    Join Date
    Feb 2003
    Location
    Bathurst, NSW, Australia
    Posts
    2,117
    I'm not sure, because I don't really know what a UDF is

  10. #85
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    Quote Originally Posted by Karmacop
    I'm not sure, because I don't really know what a UDF is
    I see, so you thought it was a good idea to suggest multiple "I don't really know what they ares", right?
    Cheers,
    Mike - obviously (I hope) joking

    UDF = User Defined Function

  11. #86

    Talking

    well Karma, when you read my response #82 you should understand.

    Lightwolf...the classic geometric function OO example would be an Area() function.

    for an object B (which is a Box), B.Area(4, 5) would be written:

    Code:
    Area: h, w {    
         return(h * w);   
    }
    but for object C (which is a Circle), C.Area(2.1) would be written:
    Code:
    Area: r {
         return(pi * r ^ 2);   
    }
    The functions become contect sensitive and clearer to read because they aren't masked by a bunch of if statements trying to handle every type of calculation. They are also easier to use.

    Keep in mind that this is all from a guy who has only read about c++ & java.

    Somewhere, over the rainbow....

  12. #87
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    Hi Gregory,
    Ah, I see what you're getting at now.
    But, in your case, you wouldn't need multiple UDFs, since the function B.Area() and C.Area are different anyhow (since B is a Box object and C is a Circle object).

    Cheers,
    Mike

  13. #88
    Hi Lightwolf,
    I think it's called function overloading (not sure). But the OO language itself is able to know which function to use depending on the variables sent into it (the context of it's use). It's part of the power of OO programming.

    but I may be blowing smoke out my *ss


    and getting OT for this thread.

    Somewhere, over the rainbow....

  14. #89
    obfuscated SDK hacker Lightwolf's Avatar
    Join Date
    Feb 2003
    Location
    Stuttgart, Germany
    Posts
    13,613
    Gregory:
    that is exactly why you need types:
    For example, I have:
    class point;
    class radius;

    Now the compiler can find the difference between a function:
    function area (point p);
    and
    function area (radius r);

    However, without types, it wouldn't know the difference. Rules to choose the right function in overloading involve
    a) number of arguments
    b) argument types
    and, if you don't have b), but still would like default argument for example, you quickly run out of choices for the compiler to find the right function.

    Cheers,
    Mike - btw, yes, overloading it is.

  15. #90
    yep...I was just following up on the multiple UDF suggestion.
    It was very insightful for a person who didn't know what a UDF is.

    Back to Thread topic:



    I wish LSED had an integrated compiler.
    And fix the LScript compiler so the relative pragma works.

    Somewhere, over the rainbow....

Page 6 of 16 FirstFirst ... 45678 ... LastLast

Bookmarks

Posting Permissions

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