Reference Operator "&" RFC
Given a variable var of type X, expression &var can result in the following commands:
- if
Xis aCarclass,&varisGET_VEHICLE_POINTER var - if
Xis aCharclass,&varisGET_PED_POINTER var - if
Xis anObjectclass,&varisGET_OBJECT_POINTER var - otherwise:
&varisGET_VAR_POINTER var
Given a label @label, expression &@label results in: GET_LABEL_POINTER @label
Examples:
int v
int p = &v
Car c
int pcar = &c
int plabel = &@label
The implementation of this expression can be quite complex, not only for the compiler but also for the users. can disable constants and variables....
const a = 6@, b = &404
car a
char b
a = &a // -> 6@ = &6@ { what is that?? }
b = &b // -> &4 = &&4 { and this?? }
Is it possible to consider pasting the AND(&) symbol to the SAME(=) symbol?
const a = 6@, b = &4
car a
char b
a =& a // -> 6@ =& 6@
b =& b // -> &4 =& &4
In the SB documentation I did not see that this expression is reserved in something. https://docs.sannybuilder.com/language/instructions/expressions
And reduces the time that has to be invested to add the expression. in the case of my compiler, it is sufficient to add an opcode and express the data order
this without adding possible critical issues in this new syntax #261
const a = 6@, b = &404
car a
char b
a = &a // -> 6@ = &6@ { what is that?? }
b = &b // -> &4 = &&4 { and this?? }
this is not allowed in latest SB. you can't use same name for a constant and variable.
Is it possible to consider pasting the AND(&) symbol to the SAME(=) symbol?
in future it will be possible to use reference as an argument to function:
someFunc(&a)
so, no, it should be treated differently
this is not allowed in latest SB. you can't use same name for a constant and variable.
i think i am getting confused. the constant a is 6@ but &a is a variable called a and this name cannot be used, why is it already reserved in a constant? then how would it pass compiled?
wait wait, so if _actor is $_actor, then using it would also be an invalid operation?
oh my god, the new Sanny builder syntaxes make me dizzy 😵💫
so, no, it should be treated differently
Are you going to set up a temporary variable system that does not affect the use of local and global variables used by the script being developed?
or how will that work? can you give an example
const foo = 6@
car foo
you can't use same name (foo) for const and variable. you will get a compiler error. it has nothing to do with & and this proposal.
Are you going to set up a temporary variable system that does not affect the use of local and global variables used by the script being developed?
something like this, not sure what exactly yet