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

What is the difference in the way these variables are declared?


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-07-2023 , 15:57   Re: What is the difference in the way these variables are declared?
Reply With Quote #11

Quote:
Originally Posted by Leech_v2 View Post
Because in actual testing, 'new' can be combined with 'public', 'static', and 'stock'.
That's why I have questions
It's probably just a no-op in that case. I can only assume they didn't exclude it from the syntax because it doesn't really change anything, you're still creating a "new" variable.

So, to summarize, your original assumption of:

Quote:
Originally Posted by Leech_v2 View Post
As far as I know, the feature of 'new' is that it allows declared variables to use runtime expressions as initialization expressions.
is incorrect as I explained previously in this thread.



Maybe think of it this way, if the syntax is:

PHP Code:
new <type> <name>; 
then when the "type" is not blank, the new can just be implied. Many languages have shorthand for certain functionality and I suspect it's just one of those cases here.
__________________

Last edited by fysiks; 10-07-2023 at 16:09.
fysiks is offline
thEsp
BANNED
Join Date: Aug 2017
Old 10-07-2023 , 16:41   Re: What is the difference in the way these variables are declared?
Reply With Quote #12

Quote:
Where did i say it’s useless? You are talking non-sense
Amxx is useless and so are you. Been browsing this forum recently and all I find is you showing everywhere like you're some important figure. In reality you're just a manchild whose main interest is playing an old ass absolutely not profitable game. Not like others are better but I'm specifically mentioning you because you (trash) talk a lot.
thEsp is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-07-2023 , 16:41   Re: What is the difference in the way these variables are declared?
Reply With Quote #13

Quote:
Originally Posted by fysiks View Post
Maybe think of it this way, if the syntax is:

PHP Code:
new <type> <name>; 
then when the "type" is not blank, the new can just be implied. Many languages have shorthand for certain functionality and I suspect it's just one of those cases here.
That’s a pretty good explanation. We can make it to test by making a static & a new static and compare them.


Quote:
Originally Posted by thEsp View Post
Amxx is useless and so are you. Been browsing this forum recently and all I find is you showing everywhere like you're some important figure. In reality you're just a manchild whose main interest is playing an old ass absolutely not profitable game. Not like others are better but I'm specifically mentioning you because you (trash) talk a lot.
I am ignoring you from now on. I am not an important figure, i never said i am. I don’t know what’s your problem but you keep trash talking and talking non-sense.

In fact to everyone here, you are the one thinking you are a big figure. You didn’t understood the thread OP’s question. You say it’s semantics and then you talk non-sense over and over again.

Pawn is a dead language, it’s a fact. It has been discontinued since 2012 and almost no one uses it. If you know any other language you would know that it makes no sense that a Float is an explicitly declared datatype but things like ints and strings are just declared by using new.
Also you have to declare how long a string might be. Because you don't know how long some input might be, so sometimes we will do things like strings with lengths of 512 cells, using kilobytes of memory. It sounds small, but this is a waste of memory.
Plus there are several bugs around and other stuff that could be improved.
Anyway, like i said previously, we will always use it because of the massive work the community has done all those years.
__________________

Last edited by Jhob94; 10-07-2023 at 17:10.
Jhob94 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-07-2023 , 19:17   Re: What is the difference in the way these variables are declared?
Reply With Quote #14

Quote:
Originally Posted by Leech_v2 View Post
What is the difference between adding 'new' and removing 'new'?

What I want to know is the purpose of using 'new' in combination with other specifier.
As far as I know, the feature of 'new' is that it allows declared variables to use runtime expressions as initialization expressions. However, runtime expressions cannot be used outside of a function, so I am wondering why it can be combined with other specifier?

Code:
new stock gVar;
stock gVar;

new static gVar;
static gVar;

new public gVar;
public gVar;

new static stock gVar;
static stock gVar;
https://raw.githubusercontent.com/co.../pawn-lang.pdf
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Leech_v2
Senior Member
Join Date: Mar 2011
Location: Chinese GuangDong
Old 10-08-2023 , 03:08   Re: What is the difference in the way these variables are declared?
Reply With Quote #15

Quote:
Originally Posted by Natsheh View Post
Are you a robot? This is not helpful.I'm not asking about the meaning of 'public', 'stock', and 'static'. I'm asking about the additional features of 'new' combined with them
Leech_v2 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-08-2023 , 13:43   Re: What is the difference in the way these variables are declared?
Reply With Quote #16

Quote:
Originally Posted by Leech_v2 View Post
I'm asking about the additional features of 'new' combined with them
Where did you get this magical idea? If it's not in the Pawn Language Guide then it's not a thing. As I said before, the Pawn Language Guide said that you replace "new" with "public", "static", or "stock". I don't see anywhere that claims there is any special functionality for "new".

I think you skipped over post #11.
__________________

Last edited by fysiks; 10-08-2023 at 13:55.
fysiks 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 10:34.


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