Raised This Month: $51 Target: $400
 12% 

[Solved] 1.7 Syntax and method "aliases"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 09-04-2015 , 14:44   [Solved] 1.7 Syntax and method "aliases"
Reply With Quote #1

Ciao guys,

can you please explain me, how does this work (taken from datapack.inc)?
PHP Code:
methodmap DataPack Handle
{
    public 
WriteCell() = WritePackCell;
}; 
What confuses me is, that on official API site the DataPack.WriteCell method looks like:
PHP Code:
void WriteCell(Handle packany cell
But as far as I understand it should look like this
PHP Code:
void WriteCell(any cell
So, how does this "alias" method definition work?
I assume that the metod just inherits the exact arguments from it's "parental" function, but what about that Handle arg?
Shouldn't it be something like bellow to exactly set the arguments and say, what argument is used as the object we are calling the method on?
PHP Code:
methodmap DataPack Handle
{
    public 
WriteCell(any cell) = WritePackCell(Handle thisany cell);
}; 

Last edited by KissLick; 09-04-2015 at 14:44.
KissLick is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 09-04-2015 , 15:17   Re: 1.7 Syntax and method "aliases"
Reply With Quote #2

The way DataPack is doing it is no longer valid in 1.8, basically, what is doing is mapping WriteCell to WritePackCell(so when the compiler finds any WriteCell(any cell) it replaces it with WritePackCell(<Handle before the ".WriteCell">, <Value in "()" of "WriteCell">);
ex:
PHP Code:
DataPack dp = new DataPack();
dp.WriteCell(5); 
becomes:
PHP Code:
DataPack datapack CreateDataPack();
WritePackCell(datapack5); 
__________________

Last edited by WildCard65; 09-04-2015 at 15:18.
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-04-2015 , 15:18   Re: 1.7 Syntax and method "aliases"
Reply With Quote #3

You should probably file a bug against the documentation generator.

Basically, when the doc generator runs across public WriteCell() = WritePackCell; it needs to be aware that WriteCell will not have WritePackCell's first argument as it's implicitly the DataPack itself.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 09-04-2015 , 15:20   Re: 1.7 Syntax and method "aliases"
Reply With Quote #4

Quote:
Originally Posted by Powerlord View Post
You should probably file a bug against the documentation generator.

Basically, when the doc generator runs across public WriteCell() = WritePackCell; it needs to be aware that WriteCell will not have WritePackCell's first argument as it's implicitly the DataPack itself.
Atm, yes the bug can cause confusion, but eventually, the bug will be irrelevent as eventually it will no longer be valid to do what DataPack is doing in 1.7
__________________

Last edited by WildCard65; 09-04-2015 at 15:20.
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-04-2015 , 15:25   Re: 1.7 Syntax and method "aliases"
Reply With Quote #5

Quote:
Originally Posted by WildCard65 View Post
Atm, yes the bug can cause confusion, but eventually, the bug will be irrelevent as eventually it will no longer be valid to do what DataPack is doing in 1.7
This is the first I've heard of this syntax being deprecated. Any source for this?

Incidentally, said syntax is still being used in the MethodMap section of the transitional guide.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 09-04-2015 , 15:31   Re: 1.7 Syntax and method "aliases"
Reply With Quote #6

https://forums.alliedmods.net/showthread.php?t=269895
Miu is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 09-04-2015 , 16:43   Re: 1.7 Syntax and method "aliases"
Reply With Quote #7

Quote:
Originally Posted by Powerlord View Post
This is the first I've heard of this syntax being deprecated. Any source for this?

Incidentally, said syntax is still being used in the MethodMap section of the transitional guide.
It's still valid syntax in SM 1.7, it's just SM 1.8 and greater that it's invalid in.
__________________
WildCard65 is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 09-04-2015 , 16:50   Re: 1.7 Syntax and method "aliases"
Reply With Quote #8

Damn! I missed that one!

I even added binding support to docparser and docgen... :-D :-D Now that is obsolete...
KissLick is offline
BAILOPAN
Join Date: Jan 2004
Old 09-05-2015 , 01:47   Re: [Solved] 1.7 Syntax and method "aliases"
Reply With Quote #9

Yeah, sorry that that led you down a dead end. The syntax was confusing and very difficult to support in the parser, so it got removed.
__________________
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 13:24.


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