SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The limitations of @...?

    I have a class Editor which has a constructor.
    When I create an Editor object I want to initialise a member variable called _editor with the window I pass in.
    So I do something like:
    However in the constructor I cannot go:
    Because what I need is the equivalent of:
    My question is this. Is there something like an eval function which will take a string and evaluate it as an expression.
    Then I could parse my string and build it up like so:
    and evaluate it.

    Any ideas...?


    ------------------
    Tempus fugit, Carpe Diem, et al

  2. #2
    Member
    Join Date
    Jun 2001
    Location
    Bedford, MA, USA
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: The limitations of @...?

    John,
    If what you really want is a way to easily create and initialize objects, then the attached zip file should help. It contains a set of include files and a sample script. With this library you can use New() to instanciate an object and pass in initialization values to its constructor.
    The attached files contain more functions than you need - it would have been too much work to trim them down to the essential pieces. On the other hand you may find the extra stuff useful.

    It's not the approach you were going for, but I hope this helps.
    - Jim




    ------------------

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: The limitations of @...?

    Thanks very much for that.
    The stuff for the constructor is a bit odd though...
    No fourth parameter...?
    why not pass in a list of ANYTYPE and have the individual constructors worry about assigning the list members to the correct class propertys (or member variables)...?
    Perhaps I am missing something.

    Still thanks alot it was useful to see it done that way.

    ------------------
    Tempus fugit, Carpe Diem, et al

  4. #4
    Member
    Join Date
    Jun 2001
    Location
    Bedford, MA, USA
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: The limitations of @...?

    John,
    I agree it's ugly under the covers. But I was trying to make the calling syntax of function New() similar to C++ and Java. i.e. constructor arguments are passed-in as individual params.
    Granted, I only allow for up to 3 params, but keep in mind, these are optional and they're ANYTYPE. If a constructor is designed to accept a single LIST OF ANYTYPE as you suggested, New() will work just fine.
    Most of my constructors have 2 params: a list of records (containing initialization values) and a boolean (to turn reporting on/off).
    - Jim

    ------------------

  5. #5
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: The limitations of @...?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Jim Griffiths:
    John,
    Granted, I only allow for up to 3 params, but keep in mind, these are optional and they're ANYTYPE. If a constructor is designed to accept a single LIST OF ANYTYPE as you suggested, New() will work just fine.
    <HR></BLOCKQUOTE>

    That's true.


    And, by the way, an old tutor of mine would mark people down if they had what he considered to be an unnecessarily overpopulated parameter list.


    ------------------
    Tempus fugit, Carpe Diem, et al

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:47 AM.

Copyright BetaSoft Inc.