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

New API and Syntax


Post New Thread Reply   
 
Thread Tools Display Modes
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 11-20-2015 , 18:24   Re: New API and Syntax
Reply With Quote #651

Quote:
Originally Posted by Neuro Toxin View Post
I'm use to casting in other langs. And can see if someone only used source pawn how they could get tricked between syntax.

Edit: lets use the new syntax here.

float val = float (someval);

Wait a sec. That's not right lol
PHP Code:
#if !defined __sourcepawn2__
/**
 * Converts an integer into a floating point value.
 *
 * @param value            Integer to convert.
 * @return                Floating point value.
 */
native Float:float(value);
#endif 
WildCard65 is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 11-20-2015 , 18:38   Re: New API and Syntax
Reply With Quote #652

Quote:
Originally Posted by KissLick View Post
Should I port this to 1.7 syntax?
And who is gonna port Zombie:Reloaded, UMC or SourceBans etc. ?
Easy, Converted it all to 1.7 syntax with nothing flat.

I suggest you replace the enum-structs with actual variables and methodmaps however...

in case you're wondering how I was able to convert it so fast, I made a regex parser in Python that changes old syntax to new syntax.
Attached Files
File Type: zip TeamGames-in-1.7-syntax.zip (84.7 KB, 79 views)
__________________

Last edited by nergal; 11-20-2015 at 19:30.
nergal is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 11-21-2015 , 00:37   Re: New API and Syntax
Reply With Quote #653

The parentheses just adds spam to the code like so:

PHP Code:
if (view_as<TFTeam>GetClientTeam(iClient))
if (
view_as<TFTeam>(GetClientTeam(iClient))) 
It should have been left as optional but there is no point arguing since it's here to stay. And yes, I know there is a TF2_GetClientTeam native or whatever it is called.

Also nergal, you don't understand how spcomp works. Old syntax and new syntax compile to the same bytecode. For all the JIT gives a shit about ("sourcemod" on srcds) they are the exact same thing and it can't tell which plugins came from old syntax and which plugins came from new syntax.

So there's no point in carrying your already-unsupported-and-defeated argument of breaking old plugins. At its core, the JIT needs to be able to support everything. The devs can make many variants of spcomp if they want to, where old plugins may not compile on one spcomp but it will in another, but the final bytecode has to be supported by the VM at the end of the day.

So congrats wasting your time converting plugins that have absolutely no change before and after with respect to the JIT.

Last edited by Potato Uno; 11-21-2015 at 00:42.
Potato Uno is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 11-21-2015 , 08:20   Re: New API and Syntax
Reply With Quote #654

Quote:
Originally Posted by Potato Uno View Post
The parentheses just adds spam to the code like so:

PHP Code:
if (view_as<TFTeam>GetClientTeam(iClient))
if (
view_as<TFTeam>(GetClientTeam(iClient))) 
It should have been left as optional but there is no point arguing since it's here to stay. And yes, I know there is a TF2_GetClientTeam native or whatever it is called.
The parenthesis requirement for view_as was added because it looks nicer then without, it's also how c++ casting works:
PHP Code:
int a 10;
void *p1 static_cast<void*>(&a); 
WildCard65 is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 11-21-2015 , 08:29   Re: New API and Syntax
Reply With Quote #655

Quote:
Originally Posted by WildCard65 View Post
Is actually:
Code:
new Float:val = float(someval);
that's an actual cast, not the same thing as view_as<float>() or Float:
Miu is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-21-2015 , 09:50   Re: New API and Syntax
Reply With Quote #656

Quote:
Originally Posted by Miu View Post
that's an actual cast, not the same thing as view_as<float>() or Float:
And that, in my opinion, adds more confusion. Yeah, tags instead of types are a really bad concept. I think that user-defined type conversions would be great, just like for example C# and C++ have.
klippy is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 11-21-2015 , 10:18   Re: New API and Syntax
Reply With Quote #657

Quote:
Originally Posted by WildCard65 View Post
Is actually:
Code:
new Float:val = float(someval);
If you want to take the example too literal.
Drixevel is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 11-21-2015 , 17:11   Re: New API and Syntax
Reply With Quote #658

Quote:
Originally Posted by Potato Uno View Post
Also nergal, you don't understand how spcomp works. Old syntax and new syntax compile to the same bytecode. For all the JIT gives a shit about ("sourcemod" on srcds) they are the exact same thing and it can't tell which plugins came from old syntax and which plugins came from new syntax.

So there's no point in carrying your already-unsupported-and-defeated argument of breaking old plugins. At its core, the JIT needs to be able to support everything. The devs can make many variants of spcomp if they want to, where old plugins may not compile on one spcomp but it will in another, but the final bytecode has to be supported by the VM at the end of the day.

So congrats wasting your time converting plugins that have absolutely no change before and after with respect to the JIT.
IIRC, the new syntax uses actual types and not tagged 32-bit integer based types unless a certain someone was lying...

So how's it compiling to the exact same bytecode regardless of version used?

You've got alotta 'splainin' to do!
__________________
nergal is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 11-21-2015 , 17:49   Re: New API and Syntax
Reply With Quote #659

Quote:
Originally Posted by nergal View Post
IIRC, the new syntax uses actual types and not tagged 32-bit integer based types unless a certain someone was lying...

So how's it compiling to the exact same bytecode regardless of version used?
what would the difference be? o__O
Miu is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 11-21-2015 , 17:51   Re: New API and Syntax
Reply With Quote #660

Quote:
Originally Posted by nergal View Post
IIRC, the new syntax uses actual types and not tagged 32-bit integer based types unless a certain someone was lying...

So how's it compiling to the exact same bytecode regardless of version used?

You've got alotta 'splainin' to do!
I seem to recall asherkin saying something about spcomp for SM 1.7(and 1.8 as well) compiling to same bytecode and it makes sense as Lysis can still decompile the new syntax without any special casing for 1.7(I BELIEVE).
WildCard65 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 22:33.


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