Raised This Month: $ Target: $400
 0% 

New API and Syntax


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 01-04-2017 , 22:20   Re: New API and Syntax
Reply With Quote #11

Quote:
Originally Posted by nergal View Post
why wouldn't there be any chance? Methodmaps are syntactic sugar.

static variables exist so there should be no reason why properties can't be static

but don't forget that property are just functions with a signature like

function property_type methodmapname_get_propname(methodmapname this);

If you want static properties, just make a static variable within the property scope and return that...
I agree.

The code below wont compile with a static tag on the property.


Quote:
Originally Posted by Neuro Toxin View Post
Is it possible to do static properties in methodmaps?

Eg:

Code:
static int s_CollectionSize = 0;

methodmap BaseCollection
{
	public BaseCollection()
	{
		return view_as<BaseCollection>(0);
	}

	static property int Size
	{
		public get()
		{
			return s_CollectionSize;
		}
		public set(int value)
		{
			s_CollectionSize = value;
		}
	}
}
I wish to be able to do the below without having to make an methodmap instance.

Code:
BaseCollection.Size = 666;
PrintToServer("BaseCollection.Size=%d", BaseCollection.Size);
__________________
Neuro Toxin is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode