www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - property with 2 arguments

reply Tony <tonytdominguez aol.com> writes:
" property functions can only have zero, one or two parameters"

I am looking for an example of an  property function defined with 
two parameters and the syntax for how it is accessed without ().
Sep 30
next sibling parent reply Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Sunday, October 01, 2017 05:57:53 Tony via Digitalmars-d-learn wrote:
 " property functions can only have zero, one or two parameters"

 I am looking for an example of an  property function defined with
 two parameters and the syntax for how it is accessed without ().
If it has two parameters, then it's a free function that can be used as a setter. e.g. property void foo(ref T t, int i) { ... } myT.foo = 42; - Jonathan M Davis
Sep 30
parent Tony <tonytdominguez aol.com> writes:
On Sunday, 1 October 2017 at 06:34:56 UTC, Jonathan M Davis wrote:
 On Sunday, October 01, 2017 05:57:53 Tony via 
 Digitalmars-d-learn wrote:
 " property functions can only have zero, one or two parameters"

 I am looking for an example of an  property function defined 
 with two parameters and the syntax for how it is accessed 
 without ().
If it has two parameters, then it's a free function that can be used as a setter. e.g. property void foo(ref T t, int i) { ... } myT.foo = 42; - Jonathan M Davis
Thanks!
Oct 01
prev sibling parent reply bitwise <bitwise.pvt gmail.com> writes:
On Sunday, 1 October 2017 at 05:57:53 UTC, Tony wrote:
 " property functions can only have zero, one or two parameters"

 I am looking for an example of an  property function defined 
 with two parameters and the syntax for how it is accessed 
 without ().
And also this, which probably shouldn't actually work: struct S { property void prop(int a, int b){} } int main(string[] argv) { S s; s.prop = AliasSeq!(1, 2); return 0; }
Oct 01
parent Tony <tonytdominguez aol.com> writes:
On Sunday, 1 October 2017 at 07:11:14 UTC, bitwise wrote:
 On Sunday, 1 October 2017 at 05:57:53 UTC, Tony wrote:
 " property functions can only have zero, one or two parameters"

 I am looking for an example of an  property function defined 
 with two parameters and the syntax for how it is accessed 
 without ().
And also this, which probably shouldn't actually work: struct S { property void prop(int a, int b){} } int main(string[] argv) { S s; s.prop = AliasSeq!(1, 2); return 0; }
Thanks! I was thinking it was something that looked like that, although the limitation to two items was puzzling.
Oct 01