ID:135117
 
error:proc :list-derived types are not supported

Feature request: I'd like to be able to make a list/proc. It's easy to work around, of course; but I'd like to be able to do it the OO way.

For example, it would be nice to be able to make

list/proc/Reverse()

var/list/result=list()

for(var/i=src.len,i>0,i--)
result+=src[i]

return result


instead of having to do something like this:

proc/Reverse(list/L)

var/list/result=list()

for(var/i=L.len,i>0,i--)
result+=L[i]

return result


[edit]
Obviously, list-derived classes and variables wouldn't make much sense, but I would love to be able to make list-derived procs!
Yep, list-derived procs would be nice, but reorganizing BYOND to support them is a little trickier than you might think.

Of course I don't know why you wouldn't want to sort the list in place, like this:
list/proc/Reverse()
var/i=1,j=len
while(i<j) Swap(i++,j--)

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Yep, list-derived procs would be nice, but reorganizing BYOND to support them is a little trickier than you might think.

Well, at least it's easy to work around =).

Of course I don't know why you wouldn't want to sort the list in place, like this:
list/proc/Reverse()
> var/i=1,j=len
> while(i<j) Swap(i++,j--)


Personally, I prefer procs that return a value instead of modifying the value they're given.