ID:1694291
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
In many other languages, you can declare constants in the form of "const i = 5;", but DM requires you to use the var keyword beforehand. Same goes for tmp and global. It'd be nice if using const, tmp, or global counted as declaring a new variable without having to use the var keyword (since these keywords are only used for variable declarations anyways).

var const/GOLD_VALUE = 1
var tmp/weather = "Raining"
var global/world_state = "Peaceful"
var static/fuzzy = "This is a keyword too! Honest!"

// vs...

const GOLD_VALUE = 1
tmp weather = "Raining"
global world_state = "Peaceful"
static fuzzy = "It's in the Red Book!"
+1

I always thought that using var/ beforehand was redundant. Furthermore, static seems to have no use in DM, but would be nice when contained in a datum which could allow us to invoke static methods and variables from within the type:
someobject
proc/static/SomeMethod()

////////////////
// in example //
////////////////

Client/New()
..()
someobject.SomeMethod()
+1

This would be a very useful feature. Also, in a file with several const/tmp declarations, this would slightly (and, depending on the number of declarations, signifigantly) lower the size of the file due to less characters required.
++
It's a total of 3 characters and a slash (so 4), I honestly don't think there's any need for it, since it's only useful to read code. At least in my opinion.
What does this add except for removing 4 characters?
In response to NullQuery
NullQuery wrote:
What does this add except for removing 4 characters?

In my opinion, it makes the code slightly easier to read and the code files would be significantly smaller with repetition in the declarations.
I wouldn't say significantly smaller, probably a few kb. It's not like you need to use 'var' for every var you declare, just once for a group.
This would be a nice feature.
Furthermore, static seems to have no use in DM

static is the same as global, functionally they act the same.
I hear the core part of the compiler is being touched again, so I'd just like to give this old thread a little nudge.
Bumping this again, just for good measure.