Raised This Month: $ Target: $400
 0% 

New API and Syntax


Post New Thread Reply   
 
Thread Tools Display Modes
BAILOPAN
Join Date: Jan 2004
Old 08-31-2014 , 12:49   Re: New API and Syntax
Reply With Quote #111

iGANGNAM: Garbage collection is what would eliminate calls to CloseHandle() - it would determine when the handle is no longer in use and automatically close it.
__________________
egg
BAILOPAN is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 08-31-2014 , 16:54   Re: New API and Syntax
Reply With Quote #112

Sorry to post again but I really want to know about the difference of using entity reference vs index, why would it hold a frame sometime by using a index? (from what we told me)
Mathias. is offline
VoiDeD
AlliedModders Donor
Join Date: Mar 2009
Location: Illinois, USA
Old 08-31-2014 , 18:02   Re: New API and Syntax
Reply With Quote #113

Ent indexes aren't normally safe to store across game frames. The game could have possibly killed the entity that was in a given index and replaced it with another the following frame.

Entity references, however, store both the entity index and the serial number of that entity. So if the game changes the entity in your index, the entity reference allows you to compare the serial number to see if that's still the correct entity.

https://wiki.alliedmods.net/Entity_R...28SourceMod%29
__________________
VoiDeD is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 09-01-2014 , 16:15   Re: New API and Syntax
Reply With Quote #114

Thanks allot for the information, I get it now.
Mathias. is offline
thesupremecommander
Member
Join Date: Apr 2012
Old 09-03-2014 , 12:56   Re: New API and Syntax
Reply With Quote #115

So, just to confirm that I'm understanding it correctly... there isn't any built-in support for storing related information via a methodmap or a class, and any such support should be implemented by somehow relating and storing information via either methods in SourcePawn or via a C++ extension. Is that correct?

Also, what are the practical differences between methodmap and class (besides the stricter coercion)? Is/will there be any reason to use class over methodmap?

Last edited by thesupremecommander; 09-03-2014 at 14:03.
thesupremecommander is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 09-03-2014 , 16:58   Re: New API and Syntax
Reply With Quote #116

What I understood about method maps is that, you can't store any vars in them. It's just list of methods for their data type (like increment/decrement method for integer or upper string/lower string for string).

So, if you want to store any vars you must use class.
KissLick is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-03-2014 , 17:35   Re: New API and Syntax
Reply With Quote #117

methodmap's are the transitional syntax for natives, class has the stricter requirements and will become the first-class object (and will have storage in the future, methodmap's never will).
__________________
asherkin is offline
splewis
Veteran Member
Join Date: Feb 2014
Location: United States
Old 09-03-2014 , 19:24   Re: New API and Syntax
Reply With Quote #118

Has there been any consideration of adding something akin to namespaces? I guess the primary purpose would be avoid having to prefix functions from extensions/plugin natives with another name.

I'm wondering if splitting those functions into another methodmap/class would help, though.
__________________

Last edited by splewis; 09-03-2014 at 19:24.
splewis is offline
thesupremecommander
Member
Join Date: Apr 2012
Old 09-03-2014 , 20:31   Re: New API and Syntax
Reply With Quote #119

Ah, that makes sense. Is there any recommended way to implement classes with storage in preparation for a future release in which the storage will be built in?
thesupremecommander is offline
BAILOPAN
Join Date: Jan 2004
Old 09-03-2014 , 21:54   Re: New API and Syntax
Reply With Quote #120

@splewis: Yeah, shoving things into methodmaps can help alleviate global namespace poisoning. Namespaces are a great idea though. I hadn't considered them for the transitional syntax. I think I could do those pretty easily.
__________________
egg
BAILOPAN is offline
Reply



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 05:21.


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