bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Structs: Return VarPtr Self - not possible

Open GWRon opened this issue 2 years ago • 1 comments

SuperStrict
Framework Brl.StandardIO

Struct STest
  Field X:Int

  Method Add:STest Ptr(value:Int)
    X :+ value
    Return Varptr Self
  End Method
End Struct

lets bcc spit out: Compile Error: Subexpression for 'Varptr' must be a variable or an element of an array, pointer or string.

So how to return a "reference" (pointer) of a struct?

"idea" is to enable structs to daisy chain methods:

myStruct.Add(x).Subtract(y).Multiply(z) 'altering the original myStruct with each Method call

GWRon avatar Oct 17 '22 19:10 GWRon