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.
Sorry if I missed something obvious but is there a specific
reason why it isn't just a class member variable?
```d
class
On Thursday, 22 July 2021 at 18:56:43 UTC, Steven Schveighoffer
wrote:
On 7/22/21 2:38 PM, apz28 wrote:
On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote:
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
On Thursday, 22 July 2021 at 03:58:38 UTC, Ali Çehreli wrote:
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) {
On 7/22/21 2:38 PM, apz28 wrote:
On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote:
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).
DMD
On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote:
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 dereference
On Thursday, 22 July 2021 at 18:16:54 UTC, Tejas wrote:
On Thursday, 22 July 2021 at 18:06:07 UTC, Paul Backus wrote:
On Thursday, 22 July 2021 at 17:38:09 UTC, Tejas wrote:
Why does this work?
```d
import std;
void main()
{
mixin("int") a;
writeln(a);
}
```
You can mix in a type:
h
On Thursday, 22 July 2021 at 18:06:07 UTC, Paul Backus wrote:
On Thursday, 22 July 2021 at 17:38:09 UTC, Tejas wrote:
Why does this work?
```d
import std;
void main()
{
mixin("int") a;
writeln(a);
}
```
You can mix in a type:
https://dlang.org/spec/type.html#mixin_types
Looks like
On Thursday, 22 July 2021 at 17:38:09 UTC, Tejas wrote:
Why does this work?
```d
import std;
void main()
{
mixin("int") a;
writeln(a);
}
```
You can mix in a type:
https://dlang.org/spec/type.html#mixin_types
On Thursday, 22 July 2021 at 05:57:02 UTC, jfondren wrote:
On Thursday, 22 July 2021 at 03:43:44 UTC, someone wrote:
... it compiles no-more: Error: found `End of File` when
expecting `}` following compound statement
... what I am doing wrong ?
You'll get the same error from this code:
```d
On 7/22/21 1:46 AM, seany wrote:
Consider :
int [] ii;
foreach(i,dummy; parallel(somearray)) {
ii ~= somefunc(dummy);
}
This is not safe, because all threads are accessing the same array and
trying to add values and leading to collision.
Correct. You must synchronize o
On Thursday, 22 July 2021 at 16:05:41 UTC, Adam D Ruppe wrote:
On Thursday, 22 July 2021 at 15:50:59 UTC, Mark Lagodych wrote:
Do static variables consume *any* memory in instances, perhaps
just for pointers to the variables?
nope
Or does compiler automatically convert
`someObject.someStatic
On Thursday, 22 July 2021 at 15:50:59 UTC, Mark Lagodych wrote:
Do static variables consume *any* memory in instances, perhaps
just for pointers to the variables?
Figured it out.
Let's try:
```d
import std.stdio;
class A {
static int
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
On Thursday, 22 July 2021 at 15:50:59 UTC, Mark Lagodych wrote:
Do static variables consume *any* memory in instances, perhaps
just for pointers to the variables?
nope
Or does compiler automatically convert
`someObject.someStaticMember` to `SomeClass.someStaticMember`?
right
[D documentation](https://dlang.org/spec/attribute.html#static)
says:
Static data has one instance per thread, not one per object.
Do static variables consume *any* memory in instances, perhaps
just for pointers to the variables? Or does compiler
automatically convert `someObject.someStaticMe
On Thursday, 22 July 2021 at 15:12:37 UTC, Adam D Ruppe wrote:
On Thursday, 22 July 2021 at 14:19:37 UTC, seany wrote:
how can I specify this with dub ?
Probably easiest to just copy the memoryerror.d file from
druntime into your dub source dir.
I did copy in subfolder /etc/linux. same as t
On Thursday, 22 July 2021 at 14:19:37 UTC, seany wrote:
how can I specify this with dub ?
Probably easiest to just copy the memoryerror.d file from
druntime into your dub source dir.
On Thursday, 22 July 2021 at 14:19:37 UTC, seany wrote:
On Tuesday, 13 July 2021 at 17:49:54 UTC, Adam D Ruppe wrote:
On Tuesday, 13 July 2021 at 16:52:43 UTC, seany wrote:
What will it return to me?
true if it succeeded.
I want to catch the segfault and a segfault has occured, I
want run a
On Thursday, 22 July 2021 at 08:16:43 UTC, Patrick Schluter wrote:
What an unreadable mess. Sorry.
Indeed LoL !!!
I would have done something like that:
```d
mixin(format!
`case r"%1$s"d :
classTickerCustom%1$s lobjTicker%1$s = new
classTickerCustom%1$s (lstrSymbolID);
On Tuesday, 13 July 2021 at 17:49:54 UTC, Adam D Ruppe wrote:
On Tuesday, 13 July 2021 at 16:52:43 UTC, seany wrote:
What will it return to me?
true if it succeeded.
I want to catch the segfault and a segfault has occured, I
want run a different code at that point.
You mean transparently r
On Thursday, 22 July 2021 at 05:57:02 UTC, jfondren wrote:
Each individual string has to compile on its own. You'll have
to concatenate strings and then mixin them.
I forgot about that !
On Thursday, 22 July 2021 at 03:13:14 UTC, seany wrote:
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 = n
On Thursday, 22 July 2021 at 09:02:56 UTC, jfondren wrote:
On Thursday, 22 July 2021 at 07:51:04 UTC, seany wrote:
OK.
Sorry for the bad question : what if i pregenerate every
possible key, and fill the associative array where each such
key contains some invalid number, say -1 ?
You mean wh
On Thursday, 22 July 2021 at 05:57:02 UTC, jfondren wrote:
On Thursday, 22 July 2021 at 03:43:44 UTC, someone wrote:
... it compiles no-more: Error: found `End of File` when
expecting `}` following compound statement
... what I am doing wrong ?
You'll get the same error from this code:
```d
On Thursday, 22 July 2021 at 07:51:04 UTC, seany wrote:
OK.
Sorry for the bad question : what if i pregenerate every
possible key, and fill the associative array where each such
key contains some invalid number, say -1 ?
You mean where each value contains some invalid number, and the
AA's k
On Thursday, 22 July 2021 at 06:47:52 UTC, Ali Çehreli wrote:
But even if it did, we wouldn't want synchronized blocks in
parallelization because a synchronized block would run a single
thread at a time and nothing would be running in parallel
anymore.
But it only affects the block, the othe
On Thursday, 22 July 2021 at 03:43:44 UTC, someone wrote:
```
Now, if uncomment those two innocuous commented lines for the
if (true == true) block:
```d
labelSwitch: switch (lstrExchangeID) {
static foreach (sstrExchangeID; gstrExchangeIDs) {
mixin(r"case r"d, `"`, sstrExchangeID, `"`,
On 7/21/21 2:17 AM, drug wrote:
> auto z = zip(x, y) // concatenate two ranges
> .map!(a=>Complex!double(a[0],a[1])) // take the current first
> element of the first range as the real part and the current first
> element of the second range as the imaginary part
On Thursday, 22 July 2021 at 07:27:52 UTC, jfondren wrote:
On Thursday, 22 July 2021 at 07:23:36 UTC, seany wrote:
On Thursday, 22 July 2021 at 05:53:01 UTC, jfondren wrote:
No. Consider
https://programming.guide/hash-tables-open-vs-closed-addressing.html
The page says :
A key is always
On Thursday, 22 July 2021 at 07:23:36 UTC, seany wrote:
On Thursday, 22 July 2021 at 05:53:01 UTC, jfondren wrote:
No. Consider
https://programming.guide/hash-tables-open-vs-closed-addressing.html
The page says :
A key is always stored in the bucket it's hashed to.
What if my keys are a
On Thursday, 22 July 2021 at 05:53:01 UTC, jfondren wrote:
No. Consider
https://programming.guide/hash-tables-open-vs-closed-addressing.html
The page says :
A key is always stored in the bucket it's hashed to.
What if my keys are always unique?
30 matches
Mail list logo