On Tuesday, 4 April 2023 at 07:08:52 UTC, Chris Katko wrote:
dscanner reports this as a warning:
```D
struct foo{
this()
{
/* some initial setup */
refresh();
}
void refresh() { /* setup some more stuff */}
// [warn] a virtual call inside a constructor may lead to
unexpected results in
cgenie via Digitalmars-d-learn wrote:
Hello,
I created a short guide on getting started with D:
https://blog.mmksoft.uk/#A%20short%20guide%20on%20getting%20started%20with%20D%20programming
This is because I recently I started to explore the language and, having
read the forum, I see DUB be
On Tue, Apr 04, 2023 at 09:35:29PM +, Paul via Digitalmars-d-learn wrote:
[...]
> Well Steven just making the change you said reduced the execution time
> from ~6-7 secs to ~3 secs. Then, including the 'parallel' in the
> foreach statement took it down to ~1 sec.
>
> Boy lesson learned in app
On 4/4/23 00:08, Chris Katko wrote:
> dscanner reports this as a warning:
>
> ```D
> struct foo{
> this()
>{
>/* some initial setup */
>refresh();
>}
> void refresh() { /* setup some more stuff */}
> // [warn] a virtual call inside a constructor may lead to unexpected
> results in
On Monday, 3 April 2023 at 23:50:48 UTC, Steven Schveighoffer
wrote:
So what you need is inside `createSpansOfNoBeacons`, take as a
reference a `ref Span[MAX_SPANS]`, and have it return a
`Span[]` that is a slice of that which was "alocated".
See if this helps.
Well Steven just making the
Recently Dmytro Katyukha brought up an issue in one of my dub packages
that is supposed to be used as a library. He even went the whole way and
came up with a simple reduced example:
https://gitlab.com/gizmomogwai/colored/-/merge_requests/3#note_1341026928.
The problem here is, that my dub pack
On 4/4/23 11:34 AM, Salih Dincer wrote:
On Tuesday, 4 April 2023 at 14:20:20 UTC, Steven Schveighoffer wrote:
parallel is a shortcut to `TaskPool.parallel`, which is indeed a
foreach-only construct, it does not return a range.
I think what you want is `TaskPool.map`:
```d
// untested, just lo
On Tuesday, 4 April 2023 at 14:20:20 UTC, Steven Schveighoffer
wrote:
parallel is a shortcut to `TaskPool.parallel`, which is indeed
a foreach-only construct, it does not return a range.
I think what you want is `TaskPool.map`:
```d
// untested, just looking at the
taskPool.map!(/* your map fu
On 4/4/23 5:24 AM, Salih Dincer wrote:
Is it necessary to enclose the code in `foreach()`? I invite Ali to tell
me! Please explain why parallel isn't running.
parallel is a shortcut to `TaskPool.parallel`, which is indeed a
foreach-only construct, it does not return a range.
I think what yo
On 4/4/23 02:24, Salih Dincer wrote:
> I don't understand what `foreach()` does :)
Hm. I forgot whether 'parallel' works only with 'foreach'. But there are
various other algorithms in std.parallelism that may be more useful with
range algorithm chains:
https://dlang.org/phobos/std_parallel
On Monday, 3 April 2023 at 23:38:52 UTC, Marcone wrote:
What do you think about using Chat GPT to create functions in D?
Well you can use GitHub Copilot in VSCode, and it is kind of
interesting but at the current time seems like a distracting
waste of time. It will probably get more useful in
On Monday, 3 April 2023 at 22:24:18 UTC, Steven Schveighoffer
wrote:
So for example, if you have:
```d
foreach(i; iota(0, 2_000_000).parallel)
{
runExpensiveTask(i);
}
```
The foreach is run on the main thread, gets a `0`, then hands
off to a task thread `runExpensiveTask(0)`. Then it gets
> Firstly, are all calls virtual in a struct/class in D?
In D structs are always value types without a vtable or inheritance.
Classes are always reference types with a vtable, but some of the
methods may be final and hence not in vtable.
> Second, could you give me some case examples where th
dscanner reports this as a warning:
```D
struct foo{
this()
{
/* some initial setup */
refresh();
}
void refresh() { /* setup some more stuff */}
// [warn] a virtual call inside a constructor may lead to
unexpected results in the derived classes
}
```
Firstly, are all calls virtual in
14 matches
Mail list logo