ID:1704073
 
Keywords: hardcode, lists, types
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
It'd be nice if /list had proper and modifiable subtypes instead of opaque ones in hard code.

For example, vars and locs are a different type of list than overlays, which is a different type of list than verbs, which is a different type of list than contents, which is a different type of list than a mere DM user can define via list/L.

It's logical to define these as actual separate types and allow the user to further define their own types.
For example, some lists would have a "readOnly" flag, some would allow only certain types as entries via a list or proc, etc.

This isn't critical, just a nice improvement to the framework.
The reason why those lists are hard-coded this way is mostly so stuff doesn't break in the back-end. BYOND is also not type-strict. Variables that hold datums are always by reference (and primitives/literals are held by value).

Yes, lists cannot be derived. If a list should be inherited, it can still be done so by composition:
MyList
var/list/list

New()
list = list(args)
..()

proc/Add(D)
list.Add(D)

proc/Remove(D)
list.Remove(D)

proc/Find(D)
return list.Find(D)


proc/Main()
var/MyList/m = new(1,2,3,4,5)
m.Add(6)
In response to Mr_Goober
Note that this was posted in "Feature Requests", not "Developer Help". This was not an accident.
In response to Mr_Goober
I'm not entirely sure how your post relates to OP.
In response to MrStonedOne
Wild Bill Bartok wrote:
Note that this was posted in "Feature Requests", not "Developer Help". This was not an accident.

MrStonedOne wrote:
I'm not entirely sure how your post relates to OP.


Mr_Goober wrote:
The reason why those lists are hard-coded this way is mostly so stuff doesn't break in the back-end. BYOND is also not type-strict. Variables that hold datums are always by reference (and primitives/literals are held by value).


BYOND is meant to be an easier language to work with, or a stepping stone if you will. It was also made to minimize the amount of work you had to put in to create a game. BYOND does a LOT of heavy lifting for you. While this is convenient and allows you to rapidly prototype and create games with a greater ease, it also comes as a performance trade-off.

If you'd like to work with data types you'll need to try another language that fits your needs.
In response to Lavitiz
Lavitiz wrote:
[snip]
As I said to Mr_Goober, I did not post this in "Feature Requests" by accident.
I don't really want to derail this, but I should note that BYOND really isn't in active development outside of the webclient. We will eventually open-source it and people can play with enhancement foo like this.
In response to Tom
Tom wrote:
I don't really want to derail this, but I should note that BYOND really isn't in active development outside of the webclient. We will eventually open-source it and people can play with enhancement foo like this.
Thanks for the frank answer. It helps a lot.