I voted No because I think this will complicate GML without really adding much. Currently, GML is quite simple to learn because it has realatively few features. It's quite easy to understand how GML works. A list had an index, and the index is stored in a variable. To access the list, you need to have the index. To get the index, you must read the variable. The variable works just like any other variable. It's all very intuitive.
How's this done with the new system? I am not an expert on this, but I have the feeling that adding new syntactic features that don't really add much functionality-wise, might confuse GM users.
So, how would such a system work exactly? When using
mylist = ds_list_create();
mylist.insert( 1, myvalue );
is mylist a local variable holding the list index? Which means that mylist is stored in some instance. So we can do
Also, can I store the list index in a(nother) variable? E.g. can I now say
li = choose(mylist1, mylist2)
What would show_debug_message(mylist) do? Can I store the list index in a variable? Also can several instances each have their own mylist (e.g. if I want every enemy instance contain a list of visited nodes)? Can I pass the variable to another instance, e.g. when an enemy wants to know if the enemy it collides with has visited node X)? Can I make a list whose index is global? And how would this be indicated? I'm guessing
How can I make my own script for lists? With the current setup I can make a ds_list_swap and have the list index as argument0 and I can then just do
//ds_list_swap(ind, pos1, pos2)
temp = ds_list_find_value(argument0, argument1)
ds_list_replace(argument0, argument1, ds_list_find_value(argument0, argument2))
ds_list_replace(argument0, argument2, temp)
With the proposed list syntax, how would such a swap script be defined in GML, in such a way that we can use mylist.swap(pos1, pos2)? Could you give an example of that?
Finally, can we have something like
to find out whether it's a list or a stack, instance, resource, particle type, etc.? E.g. by using
if mylist.type = ds_list
//code to execute if mylist is a list
where ds_list is a built-in constant?
Edit: also, what about an existence check? You cannot do
because if mylist doesn't exist, I would expect an unknown variable error. If this error won't appear, this would be an inconsistency in the system, because right now it's a rule in GML that everything to the left of a dot, has to be defined.
As you can see, this whole concept raises a lot of questions I'm really not sure about. And that while the current system seems to work fine for me (or at least not worse than the proposed system).
Edited by Erik Leppen, 25 January 2011 - 07:33 PM.