SPONSORS:






User Tag List

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Sep 1999
    Location
    San Jose,CA,USA
    Posts
    340
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    an assignment to a List Of Anytype changes the list\'s type

    All

    Here is the situation. I declare a List Of Anytype then assign it a list of string, and yes I do cast the expression on the right.

    For some reason (because I am thinking the cast should fix this) the receiving list of anytype is being re cast as a LIST OF STRING.

    Making a subsequent ListApend fails. I do have a workaround and I put the problem and my "lame solution" in the snippet of code that follows. But like I say I am not all that happy with the solution. Am I missing something here? Anyone with a better or even alternate idea please feel free to add to this thread. Worse comes to worse here is a lame hack around this problem for all.



    ------------------
    "Smoke me a kipper, I'll be back for breakfast!"
    Sincerely
    Richard Weth
    Sr. QA Engineer
    mailto:rick_weth@yahoo.com

    [This message has been edited by rick_weth (edited 07-02-2001).]
    Smoke me a kipper, I'll be back for breakfast!
    Sincerely
    Richard Weth
    Sr. QA Engineer

  2. #2
    Member
    Join Date
    Jun 2001
    Location
    Berkeley, CA, USA
    Posts
    67
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: an assignment to a List Of Anytype changes the list\'s type

    I believe a LIST OF ANYTYPE is supposed to get type cast as soon as you put a variable into it.

    You can use a LIST OF LIST OF ANYTYPE to get around the problem.

    [-] testcase TestMe()
    [ ] LIST OF LIST OF ANYTYPE llaTest
    [ ]
    [ ] ListAppend(llaTest,{"Test"})
    [ ] ListAppend(llaTest,{10})
    [ ]
    [ ] LIST OF ANYTYPE laParse
    [ ]
    [-] for each laParse in llaTest
    [ ] Print(laParse)


    That code snippet prints out both the string and the integer.

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

  3. #3
    Senior Member
    Join Date
    Sep 1999
    Location
    San Jose,CA,USA
    Posts
    340
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: an assignment to a List Of Anytype changes the list\'s type

    Well Bruce gotta admit it works!
    Also I like it better than my cheesy sleezy
    hack.

    But let me say that from a language perspective recasting a defined data type on assignment (even the first one) is preety indefensible.

    I mean if I wanted a list of "the first type I assigned" I guess this would be a great feature. But I declared a list of AnyType ususally when you work with a language (i.e C++ or Java) that is what you get! Often you do have to recast every assignemnt (like Java which I doubt anyone likes) but it's preety intuitive.

    By the way this isn't for Bruce but for anyone from Segue. Also anytime Segue wants to DOCUMENT behavior like this please do feel free! I re read List twice .. nothing was mentioned about this recast at assignment time in 4TL referance "List data Type". Also if this was defined "somewhere else" my question would be WHY!?


    ------------------
    "Smoke me a kipper, I'll be back for breakfast!"
    Sincerely
    Richard Weth
    Sr. QA Engineer
    mailto:rick_weth@yahoo.com

    [This message has been edited by rick_weth (edited 07-02-2001).]
    Smoke me a kipper, I'll be back for breakfast!
    Sincerely
    Richard Weth
    Sr. QA Engineer

  4. #4
    Member
    Join Date
    Aug 2002
    Location
    Durham, NC USA
    Posts
    60
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: an assignment to a List Of Anytype changes the list\'s type

    I know this is a really old post...
    but it looks like it still works this way. Why is it that this is the preferred method? <erg>

    To work around it, I was able to create a LIST OF ANYTYPE and populate it with a STRING and an INTEGER at inception. Then it works, and at the end of the function I delete the STRING and the INTEGER using ListDelete.

    Is there a prettier way to do this?

    Thanks!

    -TC
    --
    Tim Crone
    Broadcom

 

 

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 10:47 AM.

Copyright BetaSoft Inc.