On Thursday, 22 July 2021 at 04:46:13 UTC, frame wrote:
Of course a double* makes more sense than a void* type for the AA
here.
On Thursday, 22 July 2021 at 03:13:14 UTC, seany wrote:
If there are multiple possibilities, what is the fastest in
terms of memory? Thank you.
I believe the fastest way (as seen from your loop) would be using
pointer arithmetric and using void* keys for diagonalLengths and
an index
On 7/21/21 8:44 PM, Brian Tiffin wrote:
> What is the preferred syntax for simple on/off states?
I use std.typecons.Flag. It feels very repetitive but that's what we have:
import std.typecons;
void foo(Flag!"doFilter" doFilter) {
if (doFilter) {
// ...
}
}
bool someCondition;
void
On 22/07/2021 3:44 PM, Brian Tiffin wrote:
What is the preferred syntax for simple on/off states? Did I read that
D was moving to strictly 1 and 0 literals instead of true/false on/off
yes/no?
This is the first time I'm hearing about it, so almost certainly no.
On Thursday, 22 July 2021 at 03:44:13 UTC, Brian Tiffin wrote:
What is the preferred syntax for simple on/off states? Did I
read that D was moving to strictly 1 and 0 literals instead of
true/false on/off yes/no?
If so, is there an idiom for yes/no/maybe -1,0,1
less/equal/greater?
The following code chunk compiles perfectly:
```d
labelSwitch: switch (lstrExchangeID) {
static foreach (sstrExchangeID; gstrExchangeIDs) {
mixin(r"case r"d, `"`, sstrExchangeID, `"`, r"d : "d);
mixin(r"classTickerCustom"d, sstrExchangeID, r" lobjTicker"d,
sstrExchangeID, r" = new
What is the preferred syntax for simple on/off states? Did I
read that D was moving to strictly 1 and 0 literals instead of
true/false on/off yes/no?
If so, is there an idiom for yes/no/maybe -1,0,1
less/equal/greater?
Excuse the noise. For some backfill; getting used to DDoc.
On Wednesday, 21 July 2021 at 22:51:38 UTC, hanabi1224 wrote:
Hi, I'm new to D lang and encounter some performance issues
with fiber, not sure if there's something obviously wrong with
my code.
[...]
Following.
I am also in need of more information to increase speed of D
binaries using
I have a perimeter of a shape, given by a `double [][]` . I want
to keep the lengths of various diagonals in another associative
array.
So,
/// define some associative array to keep track of diagonals
here..
auto perimeter = new double[][] (0,0);
/// --- fill up perimeter here
Hi, I'm new to D lang and encounter some performance issues with
fiber, not sure if there's something obviously wrong with my code.
Basically, I found D lang's logical thread communication is quite
like Elixir's (process),
I have programs written in both D and Elixir but the D version
On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven Schveighoffer
wrote:
2. It's hard for me to see where the null dereference would be
in that function (the `bool` implementation is pretty simple).
-Steve
DMD complains about dereferences in three different lines. I
suspect it's `this`
On Wednesday, 21 July 2021 at 14:02:42 UTC, Adam D Ruppe wrote:
On Wednesday, 21 July 2021 at 13:56:11 UTC, Tim Gunesh wrote:
This allows you to quickly understand the content of the
class, especially in large undocumented projects.
The D compiler can auto-generate listings like that. dmd -H
On 7/21/21 7:56 AM, apz28 wrote:
On Wednesday, 21 July 2021 at 11:52:39 UTC, apz28 wrote:
On Wednesday, 21 July 2021 at 04:52:44 UTC, Mathias LANG wrote:
It seems the compiler is doing extra analysis and seeing that a null
pointer is being dereferenced. Can you provide the code for
On Wednesday, 21 July 2021 at 13:56:11 UTC, Tim Gunesh wrote:
This allows you to quickly understand the content of the class,
especially in large undocumented projects.
The D compiler can auto-generate listings like that. dmd -H makes
a .di file with the bodies stripped out you can pursue, or
On 7/21/21 5:07 AM, vit wrote:
Thanks, it works, but now I have different problem.
I need call static method for all instantions of template struct from
`crt_constructor`.
Is there way to iterate over all instantions of template?
Not unless you register them somehow upon instantiation.
Or
On Wednesday, 21 July 2021 at 12:08:21 UTC, Tim Gunesh wrote:
Is it possible to define methods outside the class in C ++
style? Something like this:
```d
class Parent{
void Print();
}
void Parent.Print(){
writeln("Hello, D!");
}
```
I was afraid that this is not possible. I'm partly
On 7/20/21 11:00 PM, Mathias LANG wrote:
But if you take a step back, I think you might find this solution is far
from ideal.
Having worked on a JSON library myself, I can tell you they are all
implemented with a tagged union. And converting a tagged union to a
tagged union is no improvement.
On 7/19/21 10:58 PM, H. S. Teoh wrote:
I didn't check the implementation to verify this, but I'm pretty sure
`break`, `continue`, etc., in the parallel foreach body does not change
which iteration gets run or not.
`break` should be undefined behavior (it is impossible to know which
loops
On Wednesday, 21 July 2021 at 03:25:03 UTC, apz28 wrote:
VisualD project - Any hint to work around
DMD version:
DMD32 D Compiler v2.096.0-rc.1-dirty
Copyright (C) 1999-2021 by The D Language Foundation, All
Rights Reserved written by Walter Bright
Failed Build Command line:
dmd -release
On Wednesday, 21 July 2021 at 12:08:21 UTC, Tim Gunesh wrote:
Is it possible to define methods outside the class in C ++
style? Something like this:
```d
class Parent{
void Print();
}
void Parent.Print(){
writeln("Hello, D!");
}
```
No and it doesn't make much sense to do so.
The
On Wednesday, 21 July 2021 at 12:08:21 UTC, Tim Gunesh wrote:
Is it possible to define methods outside the class in C ++
style? Something like this:
```d
class Parent{
void Print();
}
void Parent.Print(){
writeln("Hello, D!");
}
```
No, it's not possible.
However, [uniform function
Is it possible to define methods outside the class in C ++ style?
Something like this:
```d
class Parent{
void Print();
}
void Parent.Print(){
writeln("Hello, D!");
}
```
On Wednesday, 21 July 2021 at 11:52:39 UTC, apz28 wrote:
On Wednesday, 21 July 2021 at 04:52:44 UTC, Mathias LANG wrote:
It seems the compiler is doing extra analysis and seeing that
a null pointer is being dereferenced. Can you provide the code
for "pham\db\db_skdatabase.d" at L138 through
On Wednesday, 21 July 2021 at 04:52:44 UTC, Mathias LANG wrote:
It seems the compiler is doing extra analysis and seeing that a
null pointer is being dereferenced. Can you provide the code
for "pham\db\db_skdatabase.d" at L138 through 140 ?
```d
package(pham.db): // Line# 133
I wouldn't state it is the best way but you can try something like that:
```D
import std.complex;
import std.range : zip;
import std.algorithm : equal, map;
import std.array : array;
void main(){
auto N=2;
double[] x,y;
x.length = N;
y.length = N;
x[0] = 1.1;
x[1] =
On Wednesday, 21 July 2021 at 08:28:22 UTC, Mike Parker wrote:
On Wednesday, 21 July 2021 at 08:11:06 UTC, vit wrote:
Is it possible to call all shared static ctors in betterC?
```d
//-betterC
static immutable int i;
shared static this(){
i = 42;
}
extern(C) void main(){
assert(i
I am trying to initialize a complex dynamic array, from two
strictly real dynamic arrays (one to be the real part, the other
to be the imaginary part.
Here is simple sample of what I have tried:
-
import std.stdio;
import std.math;
On Wednesday, 21 July 2021 at 08:11:06 UTC, vit wrote:
Is it possible to call all shared static ctors in betterC?
```d
//-betterC
static immutable int i;
shared static this(){
i = 42;
}
extern(C) void main(){
assert(i != 42);
}
```
These rely on DRuntime, which is not linked in
Is it possible to call all shared static ctors in betterC?
```d
//-betterC
static immutable int i;
shared static this(){
i = 42;
}
extern(C) void main(){
assert(i != 42);
}
```
On Tuesday, 20 July 2021 at 15:59:30 UTC, Dukc wrote:
On Tuesday, 20 July 2021 at 09:24:07 UTC, Mark Lagodych wrote:
Is there a way to make myvar local to each instance of `X`
without making it a variable of `X`? Just curious.
Yes.
```d
import std.stdio;
class X {
int x(int param) {
On Wednesday, 21 July 2021 at 03:00:51 UTC, Mathias LANG wrote:
TL;DR: If you want to use loosely typed data in a strongly
typed language, you need to come up with a common type. That
common type is usually either a discriminated union (which a
JSON object is, essentially) or something that is
31 matches
Mail list logo