On Thursday, 3 October 2019 at 04:57:44 UTC, mipri wrote:
On Thursday, 3 October 2019 at 04:33:26 UTC, Brett wrote:
I was trying to avoid such things since X is quite long in
name. Not a huge deal... and I do not like the syntax because
it looks like a constructor call.
It is a constructor ca
On Thursday, 3 October 2019 at 05:20:47 UTC, mipri wrote:
It'd be nicer to do compose a range over iota, as in
iota(1, 10).newThingWithHistory
but I don't know how to do that yet. I guess c.f.
std.range.retro
This is a bit better:
#! /usr/bin/env rdmd
import std.stdio;
auto withHistory(R
On Thursday, 3 October 2019 at 04:32:52 UTC, Brett wrote:
Ok, fine!
auto r = &x.a;
Now r is a reference, great!
No, r is a pointer, not a reference. D does not have reference
variables.
But now the semantics of using the array completely change and
errors abound!
Probably because yo
On Thursday, 3 October 2019 at 04:33:10 UTC, Brett wrote:
I routinely have to generate data using points sequentially and
refer to previous points in the data set, maybe even search
them. I also may have to break up the algorithm in to parts.
I'd like to get more in to ranges but I simply do n
On Thursday, 3 October 2019 at 04:33:26 UTC, Brett wrote:
I was trying to avoid such things since X is quite long in
name. Not a huge deal... and I do not like the syntax because
it looks like a constructor call.
It is a constructor call, though. You can define your own as well:
#! /usr/bin
On Thursday, 3 October 2019 at 04:32:52 UTC, Brett wrote:
struct Y { double q; }
struct X { Y[] a; }
X x;
auto r = x.a;
r is not a reference?!?!
Arrays are (ptr,length) pairs. r is a copy of them:
#! /usr/bin/env rdmd
import std.stdio;
struct X { int[] a; }
void main() {
aut
I routinely have to generate data using points sequentially and
refer to previous points in the data set, maybe even search them.
I also may have to break up the algorithm in to parts.
I'd like to get more in to ranges but I simply do not use them
much because I don't know all the fancy stuff
On Wednesday, 2 October 2019 at 17:54:20 UTC, H. S. Teoh wrote:
On Wed, Oct 02, 2019 at 05:37:57PM +, Brett via
Digitalmars-d-learn wrote:
struct X { int a; }
X[1] x;
x[0] = {3};
or
x[0] = {a:3};
fails;
This works:
x[0] = X(123);
Should the syntax not extend to the case of
struct Y { double q; }
struct X { Y[] a; }
X x;
auto r = x.a;
r is not a reference?!?!
When updating x.a, r is not updated ;/ [I'm not sure if it just
creates a slice or what]
Ok, fine!
auto r = &x.a;
Now r is a reference, great!.
But now the semantics of using the array completely chan
On Wednesday, October 2, 2019 11:22:40 AM MDT Just Dave via Digitalmars-d-
learn wrote:
> I was reading the C++ to D page, and came across this little bit
> about when to call the base class constructor:
>
> "It's superior to C++ in that the base constructor call can be
> flexibly placed anywhere i
On Wednesday, 2 October 2019 at 15:19:43 UTC, John Colvin wrote:
I have a function that allocates a closure somewhere in it (as
shown by the result of -profile=gc).
I can't make the function nogc as it calls a lot of other GC
using code.
profilegc.log only gives me the line number of the fun
On Wednesday, 2 October 2019 at 17:22:40 UTC, Just Dave wrote:
I was reading the C++ to D page, and came across this little
bit about when to call the base class constructor:
Isn't there some inherent danger of not calling the base
constructor first?
The object's fields are pre-initialized
On Wednesday, 2 October 2019 at 18:35:39 UTC, mipri wrote:
On Wednesday, 2 October 2019 at 17:37:57 UTC, Brett wrote:
X y = {3};
works fine.
So one has to do
x[0] = y;
You could initialize x all at once. Complete example:
import std.stdio;
struct Point {
int x, y;
string
On Wednesday, 2 October 2019 at 17:37:57 UTC, Brett wrote:
X y = {3};
works fine.
So one has to do
x[0] = y;
You could initialize x all at once. Complete example:
import std.stdio;
struct Point {
int x, y;
string toString() {
import std.format : format;
On Wednesday, 2 October 2019 at 17:54:20 UTC, H. S. Teoh wrote:
On Wed, Oct 02, 2019 at 05:37:57PM +, Brett via
Digitalmars-d-learn wrote:
struct X { int a; }
X[1] x;
x[0] = {3};
or
x[0] = {a:3};
fails;
This works:
x[0] = X(123);
I'd knew I'd gotten the impression from som
On Wed, Oct 02, 2019 at 05:37:57PM +, Brett via Digitalmars-d-learn wrote:
> struct X { int a; }
>
> X[1] x;
>
> x[0] = {3};
>
> or
>
> x[0] = {a:3};
>
> fails;
This works:
x[0] = X(123);
> Should the syntax not extend to the case of array assignment?
Arguably it should. But i
struct X { int a; }
X[1] x;
x[0] = {3};
or
x[0] = {a:3};
fails;
Should the syntax not extend to the case of array assignment?
This avoids a double copy.
X y = {3};
works fine.
So one has to do
x[0] = y;
I was reading the C++ to D page, and came across this little bit
about when to call the base class constructor:
"It's superior to C++ in that the base constructor call can be
flexibly placed anywhere in the derived constructor."
Isn't there some inherent danger of not calling the base
constr
On Sunday, 29 September 2019 at 11:26:41 UTC, aberba wrote:
On Thursday, 26 September 2019 at 17:26:25 UTC, Dave Chapman
wrote:
[...]
your code... can you push it to GitHub so I can check it out?
I haven't used GitHub or git. Is there some other way?
On Wednesday, 2 October 2019 at 15:19:43 UTC, John Colvin wrote:
profilegc.log only gives me the line number of the function
signature, which doesn't give me any hint as to where in the
function the closure is allocated.
You'll wanna check any nested functions declared in that
function. Kinda
I have a function that allocates a closure somewhere in it (as
shown by the result of -profile=gc).
I can't make the function nogc as it calls a lot of other GC
using code.
profilegc.log only gives me the line number of the function
signature, which doesn't give me any hint as to where in th
Do you remember at one-arm-bandits, the casino systems that have
becharmed bettors with its unbelievable audios symbols and
positively with its payouts? From mechanical slots machines to
advanced video slots machines, slots games have developed however
have deal to stay its specific smart luck
On Wednesday, 2 October 2019 at 06:41:28 UTC, Rainer Schuetze
wrote:
thanks for the detailed answer
23 matches
Mail list logo