Quote:
Originally Posted by Steell
Right, but if we're using @ to denote array references when declaring new variables, then I feel that everywhere we're dealing with references we should also use @ to remain consistent; even though there's no functional point in including @ in function parameters, for example, new Sourcepawn 2 users will see function headers without @ for arrays and assume that they're passed by-value, since declaring new arrays without the @ means precisely that.
|
I realize Proposal #4 was pretty light on details, so let me clarify. "@" would not a by-reference qualifier; it's a box that contains a value. Boxes would have no relation to arrays whatsoever. You could store boxes inside boxes, or scalars, etc.
Think of it like wrapping an array inside an object. You can re-point the box at another box, or you can change the value inside the box, but these are different from pass-by-reference. The box itself is a reference that contains a value or reference.
Whatever the case, I don't think it ever makes sense to pass arrays by value, and it would break almost every plugin in existence. The notion of "consistency" here doesn't factor in.
__________________