On Friday, 6 July 2018 at 16:24:03 UTC, Timoses wrote:
On Friday, 6 July 2018 at 15:51:34 UTC, Michael wrote:
[...]
While writing I realized that the following is even the case
without the 'ref' parameter:
The caller of the setter will still be able to change the
content of your private data
On Friday, 6 July 2018 at 15:51:34 UTC, Michael wrote:
Also, yes, I am using the setter method to play around with the
precision of the double values, and do some normalising.
While writing I realized that the following is even the case
without the 'ref' parameter:
The caller of the setter will
On Friday, 6 July 2018 at 15:57:27 UTC, Timoses wrote:
On Friday, 6 July 2018 at 15:33:18 UTC, Michael wrote:
This is definitely to do with my use of the setter syntax,
which maybe I am misunderstanding? Because if I change it to a
normal function call like so:
On Friday, 6 July 2018 at 15:33:18 UTC, Michael wrote:
This is definitely to do with my use of the setter syntax,
which maybe I am misunderstanding? Because if I change it to a
normal function call like so:
a.beliefs(Operator.create());
then it complains if I use ref, and doesn't complain
On Friday, 6 July 2018 at 15:37:25 UTC, Timoses wrote:
On Friday, 6 July 2018 at 15:14:01 UTC, Michael wrote:
class Agent
{
private
{
double[int] mDict;
}
// Setter: copy
void beliefs(ref double[int] dict)
{
import std.stdio : writeln;
On Friday, 6 July 2018 at 15:14:01 UTC, Michael wrote:
class Agent
{
private
{
double[int] mDict;
}
// Setter: copy
void beliefs(ref double[int] dict)
{
import std.stdio : writeln;
writeln("Setter function.");
this.mDict = dict;
}
On Friday, 6 July 2018 at 15:14:01 UTC, Michael wrote:
On Friday, 6 July 2018 at 14:50:39 UTC, Ali Çehreli wrote:
[...]
I'm just trying to do that now.
Here is what I have in terms of code:
[...]
This is definitely to do with my use of the setter syntax, which
maybe I am
On Friday, 6 July 2018 at 14:50:39 UTC, Ali Çehreli wrote:
On 07/06/2018 07:36 AM, Michael wrote:
> but not in
> my case, if this is a weird edge-case with setter member
functions?
This is all very interesting but I'm dying to see the code. :)
Can you change Timoses's code to demonstrate your
On 07/06/2018 07:36 AM, Michael wrote:
> but not in
> my case, if this is a weird edge-case with setter member functions?
This is all very interesting but I'm dying to see the code. :) Can you
change Timoses's code to demonstrate your case?
Ali
On Friday, 6 July 2018 at 14:11:42 UTC, Timoses wrote:
This works for me:
auto create()
{
string[int] dict;
dict[2] = "hello";
return dict;
}
void modifyNoRef(string[int] m)
{
writeln("Address not ref: ", );
m[0] = "modified";
On Friday, 6 July 2018 at 14:11:42 UTC, Timoses wrote:
On Friday, 6 July 2018 at 13:13:43 UTC, Michael wrote:
static auto ref consensus( ... )
`auto ref` infers the return type from the return statement
[1]. So it's not necessarily returning a ref type.
However, I don't think this matters
On Friday, 6 July 2018 at 13:13:43 UTC, Michael wrote:
static auto ref consensus( ... )
`auto ref` infers the return type from the return statement [1].
So it's not necessarily returning a ref type.
However, I don't think this matters if the only concern you have
is that the setter
Hello,
I'm a little confused about what is actually happening when I try
to pass a reference, returned by a method that produces the
object (associative array), to a setter method which expects a
reference. What seems to be happening is that it simply does
nothing, as if the setter method is
13 matches
Mail list logo