View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-25-2019 , 23:03   Re: Development Roundup, We need you!
Reply With Quote #55

Quote:
Originally Posted by <VeCo> View Post
Hey, I was looking around the example codes from the 1.9 API changes page and some of the default plugins, and I noticed some peculiar coding style which made me wonder.

As far as I understand, callbacks from within the plugin now use the short '@' symbol (which actually becomes part of their name), while forwards registered from includes use the full 'public' keyword. I assume that improves code readability, but can you shed some more light on this? Do you encourage it as a new standard coding practice?
There is no functional difference between declaring a function or variable as public using 'public' instead of 'new' or starting the name with '@':

Quote:
Originally Posted by Pawn Language Guide
Global “simple” variables (no arrays) may be declared “public”
in two ways:
⋄ declare the variable using the keyword public instead of new;
⋄ start the variable name with the “@” symbol.
The only difference being that the '@' become part of the name (as you noticed).

Since they are functionally the same, someone could choose to use the difference to convey certain context as you explained already. Very few plugins (2 of 21) actually use this method so it certainly can't be called a new standard practice for AMX Mod X. IMO, someone noticed that it worked and figured that they wanted to be different.
__________________

Last edited by fysiks; 02-25-2019 at 23:07.
fysiks is offline