ID:1001655
 
Keywords: eval, interpreting
Not Feasible
Applies to:DM Language
Status: Not Feasible

Implementing this feature is not possible now or in the foreseeable future
How hard would it be to fix the eval() proc or remake it altogether? I'm honestly not sure what it's currently capable of or how broken it is, since it's undocumented, but if it was anything like the eval function in other languages, then I sure would love to have it. You could run strings of DM code during runtime, to interact with your program, without the need for recompiling or even access to the original source. Now, correct me if I'm wrong, but currently the eval() proc uses DM script, and not the actual DM code, right? Now, what if you made it so that it did actually use the full DM code? Then, the DM language would officially become self-interpreting!

Now I don't know what happened back then, but why would you let this awesome feature go? I would totally abuse this proc, and for my purposes, I wouldn't even care if it caused a significant amount of lag!

With a fully interpreting eval(), you could let users run their own pieces of code during runtime without the risk of opening the main source, and the program's new state could basically even be "saved" to a savefile, for running again later. You could run all sorts of quick tests and debugging code without having to wait for the compiler. The possibilities opened by self-interpretation would quite literally, be more than endless. You could make all sorts of interactive programs that can teach people the DM language, without worrying about them messing up the base program's source code. They could pretty much tweak the program all they want with no outcome ever worse than a crash.

So, would it be feasible to extend the functionality of eval() to the point of self-interpretation, or to at least fix whatever is broken about it? I would imagine it to be much easier to implement this built-in, on the level of BYOND, given the higher degree of freedom, rather than making an interpreter in the DM language itself.

Also, please tell if anyone else might want to use something like this, and for what reason. I know that others have asked about it in the past.
eval()
dm script
dan
nope
Nadrew resolved issue (Not Feasible)
It's just not workable with how things are now, it's been brought up in the past but it involves some pretty deep dark parts of the compiler and interpreter.
Well, I'm sorry to hear that. BYOND must be a pretty scary thing on the inside. If only Dan were still here, then maybe the DM script would get finished, and eval() would be fully working. Well, I guess that I just have to assume that eval() has gone the way of DUNG, left under the shadows of BYOND.

I guess if we want an interpreter, we will have to write one ourselves, in the DM language...
There are a few around, actually. I know AbyssDragon wrote one:
http://www.byond.com/developer/AbyssDragon/SET

Popisfizzy also wrote one but it seems he rage quit and deleted all of his awesome creations :(

You could also look into using something like Nckr5's awesome scripting library:
http://www.byond.com/developer/Nickr5/n_Scripting
Any chance of getting this with the recent renovations to the compiler?
I'm sure an in-house eval() interpreter wouldnt be too difficult to create as a library.
Bump
This request was already closed. The eval() proc is not going to be expanded; it only ever covered a limited subset of operations anyway. Existing libraries for this sort of thing are a better way to go.
GatewayRa wrote:
then why isnt it taken out entirely since its so broken
also so people can use eval() as a proc name

Exactly what I was thinking.
IIRC it had a memory leak long ago, but that has since been shored up and the proc works--but it's very limited in scope. I'm not certain there are no games using it, but it probably could be pulled out with no harm. Still though, it can also be left with no harm.
Does it issue a deprecation warning when used? It might be handy to do so, at least to offer some warning to those who are upgrading old games that they shouldn't be using it anymore. Then after a time, you could just remove it entirely, if that helps clean up the codebase at all.
I don't think you should be so quick to remove it. It's possible that in the future, if BYOND goes open source, that someone might decide to update the eval() function. It's also possible that if eval() is currently somewhat working, that it could have fixed some older games that might have been using it, but it's hard to know for sure.
If/when BYOND open sources, it would probably be better for someone to start from scratch anyway. No use in keeping a proc like this in if it's not going to get proper support.