ID:1611890
 
(See the best response by Stephen001.)
I was wondering if it would even be possible to add to DM.

mob
Login()
var/list/Test = list()
Test += src
var A = Test[1]:Bloop()
world << A
proc
Bloop()
return ":D"
Best response
You couldn't really ensure the compile-time type of the object in question (or that is even was an object), so not really?
In response to Stephen001
Stephen001 wrote:
You couldn't really ensure the compile-time type of the object in question (or that is even was an object), so not really?

My bad I meant to use : instead, which would fix the problem correct?
In response to Kozuma3
Kozuma3 wrote:
Stephen001 wrote:
You couldn't really ensure the compile-time type of the object in question (or that is even was an object), so not really?

My bad I meant to use : instead, which would fix the problem correct?

Correct, that is what that operator is specifically used for, so I'm not exactly sure why it wouldn't be able to use reflection to call the proc?
wait...you made a feature request about this a year ago. almost exactly a year.

id:1313313
I didn't want to necro the topic and I don't even know if it's feasible or worth adding :P
It's not doable with the strict reference operator, no, and it won't be (or make sense), by definition of what the operator does.

What you're actually asking for, is stronger typing on lists, to be able to go:

mob
Login()
var/list<mob>/Test = list()
Test += src
var A = Test[1].Bloop()
world << A
proc
Bloop()
return ":D"


Which, depending on the semantics, could be a pain in the arse. Do you enforce mob-safety on add() += and other insert operations on the list? What happens when you type-cast either to remove the restriction, or make it tighter? etc etc.

It kinda muddies the language a fair bit, for a one line convenience. And for a learner/first language, clear and well understood semantics (something BYOND does struggle with in a few areas) is king.
In response to Stephen001
Stephen001 wrote:
It's not doable with the strict reference operator, no, and it won't be (or make sense), by definition of what the operator does.

What you're actually asking for, is stronger typing on lists, to be able to go:

> mob
> Login()
> var/list<mob>/Test = list()
> Test += src
> var A = Test[1].Bloop()
> world << A
> proc
> Bloop()
> return ":D"
>

Which, depending on the semantics, could be a pain in the arse. Do you enforce mob-safety on add() += and other insert operations on the list? What happens when you type-cast either to remove the restriction, or make it tighter? etc etc.

It kinda muddies the language a fair bit, for a one line convenience. And for a learner/first language, clear and well understood semantics (something BYOND does struggle with in a few areas) is king.

Okay, thank you.