mob
Login()
var/list/Test = list()
Test += src
var A = Test[1]:Bloop()
world << A
proc
Bloop()
return ":D"
ID:1611890
Jun 27 2014, 1:26 pm (Edited on Jun 27 2014, 2:41 pm)
(See the best response by Stephen001.)
|
|
I was wondering if it would even be possible to add to DM.
|
Jun 27 2014, 2:09 pm
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: 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? |
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 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. > mob 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. Okay, thank you. |