Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14

Thread: ArrayLists in ASH? [Discussion]

  1. #11
    Join Date
    Aug 2009


    Looking at the Java API I think I would want size() added to heeheehee's minimum for sets and lists. I'd consider contains() as a useful addition to lists but of mildly less importance.
    Originally Posted by fronobulax View Post
    I think a lot of these have existing analogues. To add to Veracity's examples:

    set contains obj
    foreach obj in set
    remove set[obj];

    list contains obj
    foreach obj in list
    remove list[index]

    add / insert is the only one off the top of my head that would probably require special syntax (or a new function). Polymorphism could mean that we could even use append(aggregate, obj), although I think I'd prefer one of the names add / insert (preferably with the ability to specify index for lists, too).

  2. #12
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    The Unseelie Court


    I'm planning on working on it this (long holiday) weekend.
    I pinged zarqon, asking for his contribution to the discussion, since non-backward-compatible versions of this directly affect his scripts.
    Still hoping he responds, before I start spending time on it...

  3. #13
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Seoul, Korea


    I quite appreciate your messaging me about this. Unfortunately I won't have time to formulate proper opinions and give a proper response until after the weekend (out of town gigs). Would be nice if it were a holiday weekend over here now as well!

    I can say for now that I'd be happy to change the list-handling functions in ZLib to not use the word "list" as a variable. Those functions mainly enable functionality which it looks like this new feature will replace, so the new ASH feature may deprecate that section of ZLib anyway.

    More on this after the weekend. Will endeavor to push an update to ZLib renaming the variables tonight.
    Sig by JakAtk
    My scripts: Prefref Plus | Skillref Plus | One-Click Wossna | Om*****st (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mercenary Mood | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | Drag-n-Drop Inventories | CanAdv | Script Registry | Map Manager
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  4. #14


    Maybe it's too late to contribute anything to this discussion, so ignore this if the feature is already done.

    Is there a reason to create a list type instead of just extending the functionality of arrays to act more like arraylists? From an end-programmer perspective, you can basically treat an arraylist and an array as identical concepts, except arraylist allows resizing. It seems much more elegant to add insert/remove functionality to arrays to make them more like arraylists than to introduce a whole new collection type. And as an added benefit, you don't break anyone's code who uses the word "list". What is the benefit to having two similar collection types when one is simply a superset of the functionality of the other?

Posting Permissions

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