List & Nodes
Monkey Forums/Monkey Programming/List & Nodes
| ||
Ok, I'm stuck with this thing I get the error Compiler error: Duplicate identifier 'Node' found in module 'map' and module 'list'. the method AddLast return a 'Node' object so what's wrong? |
| ||
Ooerr, that's not good! It's a namespace problem: the class Node is defined in both std.list and std.map, so you need to say which one you want. Do that by writing Field mylink:list.Node<type> |
| ||
What are nodes used for? |
| ||
Thanks Warpy! Another thing learned... @therevills: They are the equivalent of BlitzMax's LINKS: they are the 'link' (or the node) to an object in a list |
| ||
Shouldn't be Monkey aware of that? I mean Node is defined in both list and map BUT it has only one template parameter in list and two parameters in map so Monkey should be able to distinguish between them without the need to add the namespace? |
| ||
Hi, > Shouldn't be Monkey aware of that? No, symbols in imported modules are only 'auto imported' if there are NO duplicates. You can use the new Alias to deal with this too: Alias Node=list.Node ...or even... Alias MapNode=map.Node Alias ListNode=list.Node ...at the top of your code. |
| ||
Ah alright, thanks for that Mark. |