Page 1 of 4

[Implemented] LinkedLists inside Structures

Posted: Thu Jan 10, 2008 10:42 am
by ZeHa
Hello,

I think it would be essential to be able to do something like this:

Code: Select all

Structure Player 
    xPos.l 
    yPos.l 
    NewList weapons.Weapon()       ; <-- look here :)
EndStructure
There are a few workarounds like creating your own lists and so on, but I think this should be a native feature of PB.

Would this be possible for 4.2 or 4.3? :)

Re: LinkedLists inside Structures

Posted: Thu Jan 10, 2008 12:20 pm
by Kiffi
A good idea! I second this! :D

Greetings ... Kiffi

Posted: Thu Jan 10, 2008 12:36 pm
by milan1612
Would be veeery handy :D

Posted: Thu Jan 10, 2008 12:58 pm
by Dare
Nice and powerful addition.

+1

Posted: Thu Jan 10, 2008 1:13 pm
by JCV
+1

That would be nice!

Posted: Thu Jan 10, 2008 1:22 pm
by #NULL
yeah :D , would spare me my barely working amateur tree list stuff 8)

Posted: Thu Jan 10, 2008 8:32 pm
by DoubleDutch
+1 :)

Posted: Fri Jan 11, 2008 10:24 am
by Hurga
I agree

+1

Posted: Fri Jan 11, 2008 5:52 pm
by Demivec
+1 8)

Posted: Fri Jan 11, 2008 5:56 pm
by DarkDragon
++

Posted: Fri Jan 11, 2008 7:13 pm
by Hroudtwolf
I disagree.
A dynamic linkedlist lib would be more important.

Code: Select all

Structure tProps
   sName.s
   sAssoc.s
EndStructure

Structure tMyData
   sName.s
   sEmail.s
   *Properties.tProps
EndStructure

*List.tMyData = NewList
AddElement (*List)
*List\sName = "Frédéric Laboureur"
*List\sEmail = "support [at] purebasic.com"
; With dynamic instanced LinkedList, you could do that.
*List\Properties = NewList
AddElement (*List\Properties)
*List\Properties\sName = "talent"
*List\Properties\sAssoc = "Developed a realy cool programming language."
Best regards

Wolf

Posted: Fri Jan 11, 2008 7:17 pm
by IceSoft
Why not both?

Posted: Fri Jan 11, 2008 7:44 pm
by Hroudtwolf
LinkedList in structures would make necessary to change the syntax of purebasic.
That could be a new source of bugs. *paranoia*

Best regards

Wolf

Posted: Fri Jan 11, 2008 8:12 pm
by Berikco
-6

Posted: Sat Jan 12, 2008 12:45 am
by ZeHa
@ Hroudtwolf: Why would the syntax change?!

I think it's totally important to have this. Otherwise, you can only have global lists and not bind them to an object. What do you do when you want to have a linked list for every new object you create? Let's say you've got a structure for a "person", and the person should be able to carry an arbitrary amount of stuff in his pockets. How would you do that? You can only use fixed-length arrays inside a structure.