and if I remove the parentheses, the error goes away
myDelegate = WeakAddressOf self.myObject.myMethod
LR might include that? AddressOf and WeakAddressOf apparently don’t use the familiar method syntax where the parens are optional - looks like the the parens can’t be there or we get a syntax error.
AddressOf and WeakAddressOf are actually listed as Operators so they have a different syntax. AddressOf is also listed on the Keywords page, as is AddHandler, but WeakAddressOf isn’t there. Not sure what to make of that.
I get it, but that argument for not using parens doesn’t work, since with operators, we can still use parens if we want to:
x = 1+ aValue
x = (1 + aValue)
if ( thisValue ) or not ( thatValue ) then
etc.
Right? So it still seems to me if there is some reason parens can’t be used, there should be a note about it, because it looks like perfectly valid code to use the parens, both if I’ve mistaken it for a function, and if I understand it’s an operator.
The grammar says “no parens”
They’re illegal in that case
Thats why
They have their own syntax production rules since they are not like + / - etc which they can be combined in any kind of generalized way in an “expression”
You can’t write (even hypothetically)
dim i as delegate = i + WeakaddressOf( someMethod )