On Wednesday, 24 July 2019 at 16:16:15 UTC, Greatsam4sure wrote:
On Wednesday, 24 July 2019 at 15:57:06 UTC, a11e99z wrote:
On Wednesday, 24 July 2019 at 15:56:13 UTC, a11e99z wrote:
On Wednesday, 24 July 2019 at 15:45:08 UTC, Greatsam4sure
wrote:
int main(){
double mum = 0;
Write("enter a n
On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote:
Hello,
I don't quite understand why isEven is called twice in the 2nd
example?
auto isEven(int n) {
n.writeln;
return (n % 2) == 0;
}
void main() {
auto z = [1,2,3];
// outputs 1 2 3
On Friday, 9 August 2019 at 12:26:59 UTC, John Colvin wrote:
import std.stdio;
interface I
{
void foo();
}
class C : I
{
override void foo() { writeln("hi"); }
}
abstract class AC
{
void foo();
}
class D : AC
{
override void foo() { writeln("hi"); }
}
void main()
{
auto c
On Sunday, 11 August 2019 at 15:27:54 UTC, Sjoerd Nijboer wrote:
The following snippet doesn't compile
I am trying to reflect on a class and only do an operation with
all member functions of a class.
But I can't seem to use a filter to only get the member
functions out of a type T.
I underst
On Sunday, 11 August 2019 at 16:11:15 UTC, DanielG wrote:
int[][] whatever = [
[0],
[0, 1, 2],
[5, 6, 7, 8, 9, 10]
];
writeln(whatever[2]);// [5, 6, 7, 8, 9, 10]
writeln(typeid(whatever[2]));// int[]
auto x = whatever[2].filter(x => x > 7); // error
Er
On Tuesday, 13 August 2019 at 04:43:29 UTC, Paul Backus wrote:
On Monday, 12 August 2019 at 22:48:43 UTC, Bert wrote:
Making a field static is effectively a global variable to the
class.
I have a recursive class structure(think of a graph or tree)
and I need to keep a global state for it, but
On Monday, 12 August 2019 at 22:48:43 UTC, Bert wrote:
Making a field static is effectively a global variable to the
class.
I have a recursive class structure(think of a graph or tree)
and I need to keep a global state for it, but this state
actually needs to be different for each tree object
On Tuesday, 13 August 2019 at 08:41:02 UTC, Bert wrote:
On Tuesday, 13 August 2019 at 04:43:29 UTC, Paul Backus wrote:
It seems to me like the obvious solution is to use two
different classes, one to store the global state, and one to
store the individual objects in your structure. For example:
On Wednesday, 28 August 2019 at 05:17:28 UTC, Jabari Zakiya wrote:
Inside func2 I create an input value for func1 and then assign
func1's 4 outputs to named variable. That's where the problems
arise. func1 does some math based on the input and generates 4
outputs.
I can't do (a, b, c,d) = fun
On Wednesday, 28 August 2019 at 13:11:46 UTC, Jabari Zakiya wrote:
When I do this:
uint a; uint b; uint[] c; uint[] d;
AliasSeq!(a, b, c, d) = genPGparameters(pg);
modpg= a;
res_0= b;
restwins = c;
resinvrs = d;
the compiler (ldc2 1.17) says:
D Projects ~/D/bin/ldc2 --release
On Thursday, 29 August 2019 at 10:39:44 UTC, Jabari Zakiya wrote:
The values modpg, res_0, restwins, and resinvrs are constant
(immutable) values that are generated at run time. They are
global/shared and used inside threads.
So this process is initializing them at the start of the
program, b
On Thursday, 29 August 2019 at 08:58:18 UTC, Mek101 wrote:
As the title says, is there a way to test the return type of
the 'unaryFun' and 'binaryFun' templates from 'std.functional'?
I have the following code, and I want to to be sure that
'predicate' returns a boolean, but neither
'is(typeo
On Thursday, 5 September 2019 at 09:07:30 UTC, berni wrote:
import std.algorithm: reverse;
writeln(q.reverse);
How to get this working? (I hope I don't annoy you by asking
that much questions, but I've got the feeling, that I've got
only two choices: To shy away from using immutable (like I d
On Wednesday, 11 September 2019 at 08:35:02 UTC, berni wrote:
I'd like to write a template, that takes a different default
value depending on the type of a variable. I tried this, but it
doesn't work:
void main()
{
double a = 1e-8;
double b = 1e-10;
float c = 1e-4;
float d = 1e-6;
On Wednesday, 18 September 2019 at 12:03:28 UTC, berni wrote:
The following code doesn't compile:
import std.stdio;
void main()
{
import std.complex: abs, complex;
import std.math: abs;
auto a = complex(1.0,1.0);
auto b = 1.0;
writeln(abs(a));
writeln(abs(b));
}
The error
On Wednesday, 18 September 2019 at 13:24:05 UTC, berni wrote:
On Wednesday, 18 September 2019 at 12:37:28 UTC, Simen Kjærås
wrote:
How to resolve this, though? The simplest solution is to not
use selective imports:
import std.math;
import std.complex;
writeln(abs(complex(1.0,1.0))
On Thursday, 19 September 2019 at 10:25:01 UTC, berni wrote:
On Thursday, 19 September 2019 at 07:26:17 UTC, Simen Kjærås
wrote:
That does indeed fail to compile, and there's no easy way to
introduce the module-level abs() function to the scope. Again
though, MergeOverloads to the rescue:
I'm
On Tuesday, 15 October 2019 at 07:06:35 UTC, John Colvin wrote:
On Monday, 14 October 2019 at 19:45:11 UTC, Paul Backus wrote:
On Monday, 14 October 2019 at 17:00:56 UTC, John Colvin wrote:
Different ability to access a property depending if I'm
inside something else when I look?
[snip]
You
On Sunday, 27 October 2019 at 17:52:51 UTC, Emmanuelle wrote:
Hello! See snippet:
---
interface AST
{
static interface Expr : AST
{
final static class Name : Expr
{
override void accept(AST.Visitor v) {
v.visitName(this); }
}
}
final static
On Tuesday, 29 October 2019 at 22:24:20 UTC, Robert M. Münch
wrote:
I quite often have the pattern where a value should be read
just once and after this reset itself. The idea is to avoid
that others read the value by accident and get an older state,
instead they get an "invalid/reset" value.
On Wednesday, 30 October 2019 at 11:53:42 UTC, Jacob Carlborg
wrote:
On 2019-10-30 00:28, Simen Kjærås wrote:
Something like this?
T readOnce(T)(ref T value) {
auto tmp = value;
value = T.init;
return tmp;
} unittest {
int i = 3;
assert(i.readOnce == 3);
assert(i
On Wednesday, 30 October 2019 at 20:22:25 UTC, Q. Schroll wrote:
struct Example
{
private void helper(int i, this X)() { }
void funcTempl(T, this X)(T value)
{
this.helper!0();
// ^ Why do I need this?
}
}
void main()
{
auto ex = Example();
ex.funcTempl(1
On Friday, 8 November 2019 at 11:46:44 UTC, Marcone wrote:
I can encode "Helo World!" to Base64 and get "TWFyY29uZQ==",
but if I try to decode "TWFyY29uZQ==" I can not recovery "Helo
World!" but [77, 97, 114, 99, 111, 110, 101]. How can I recover
"Helo World!" when decode? Thank you.
import
On Thursday, 14 November 2019 at 09:30:23 UTC, user9876 wrote:
A good thing is that in many cases the template instance
parameters can be deduced from the arguments used:
---
import std;
void main()
{
assert(max(0,1) == 1);
// same as assert(max!(int,int)(0,1) == 1);
}
---
This featur
On Wednesday, 8 January 2020 at 08:26:51 UTC, user1234 wrote:
class Example
{
@disable this() { pragma(msg, "not allowed..."); }
}
void main()
{
new Example();
}
outputs:
not allowed...
/tmp/temp_7F8C65489550.d(12,5): Error: constructor
`runnable.Example.this` cannot be used because
On Wednesday, 8 January 2020 at 07:03:26 UTC, Jonathan M Davis
wrote:
you could just document that no one should ever use its init
value explicitly, and that they will have bugs if they do
You also create a static init member marked @disable:
struct S {
@disable this();
@disable static
On Tuesday, 28 January 2020 at 07:36:25 UTC, Malte wrote:
I want to format an array using the %(...%) syntax. How can I
change the separator? I tried to use ? and add it as additional
parameter, but that doesn't seem to work on arrays:
import std;
void main()
{
writeln("This works:");
On Wednesday, 12 February 2020 at 08:44:24 UTC, cc wrote:
Is there some way to globally declare version= or debug=
statements in a file and have them apply to the entire project
being compiled? As the documentation says these only apply to
the module scope they exist in, and need to be added t
On Monday, 17 February 2020 at 11:07:33 UTC, foozzer wrote:
Hi all,
There's something in Phobos for that?
Thank you
import std.meta : staticMap;
import std.typecons : Tuple;
// Turn types into arrays
alias ToArray(T) = T[];
// Leave everything else the same
alias ToArray(T...) = T;
// Now ap
On Monday, 17 February 2020 at 11:51:52 UTC, FeepingCreature
wrote:
On Monday, 17 February 2020 at 11:07:33 UTC, foozzer wrote:
Hi all,
There's something in Phobos for that?
Thank you
Here you go:
import std;
// extract the types that make up the tuple
auto transposeTuple(T : Tuple!Types[]
On Monday, 17 February 2020 at 11:51:52 UTC, FeepingCreature
wrote:
Here you go:
import std;
// extract the types that make up the tuple
auto transposeTuple(T : Tuple!Types[], Types...)(T tuples)
{
// templated function that extracts the ith field of an
array of tuples as an array
aut
On Monday, 17 February 2020 at 13:03:38 UTC, Basile B. wrote:
eg
Sh(echo) < "meh";
struct Sh
{
// you see the idea we have op overload for < here
}
You can't overload < separately - all the comparison operators
(<, <=, >, >=) are handled via opCmp. Even if you choose to go
down that
On Monday, 17 February 2020 at 14:04:34 UTC, Adnan wrote:
cdsa ~master: building configuration "cdsa-test-library"...
source/strassens_matmul.d(22,16): Error: cannot implicitly
convert expression &mat[row][column] of type const(uint)* to
uint*
source/strassens_matmul.d(37,36): Error: template i
On Tuesday, 18 February 2020 at 12:37:45 UTC, Adnan wrote:
I have a base class that has a couple of constant member
variables. These variables are abstract, they will only get
defined when the derived class gets constructed.
class Person {
const string name;
const int id;
}
class Male
On Tuesday, 18 February 2020 at 12:43:22 UTC, Adnan wrote:
class Wife(uint N) : Female {
FemaleID engagedTo = -1;
const MaleID[N] preferences;
this(MaleID[N] preferences) {
this.preferences = preferences;
}
}
void engage(N)(ref Wife!N, wife, ref Husband!N husband) {
On Wednesday, 26 February 2020 at 08:32:50 UTC, Abby wrote:
On Wednesday, 26 February 2020 at 08:25:00 UTC, Abby wrote:
Any idea why?
Ok so this is enough to produce the same result, it seems that
there is a problem in string switch when there is more the 6
cases.
extern(C) void main()
{
On Thursday, 27 February 2020 at 11:28:11 UTC, Mitacha wrote:
I've a const struct object and I'd like to make a mutable copy
of it.
Struct definition contains string and an array of structs.
```
struct A {
string a;
B[] b;
}
struct B {
string a;
string b;
}
```
As far as I can t
On Friday, 28 February 2020 at 08:08:59 UTC, Виталий Фадеев wrote:
On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев
wrote:
Searching solution for idea !
Goal is to get System message, dispatch/route to method !
If method implemented only !
I dream on in future write clean code of a
On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев wrote:
Searching solution for idea !
For whatever reason, it seems my attempts at answering this
earlier has disappeared into the void. Here:
import core.sys.windows.windows;
import std.stdio;
class Base {
LRESULT On(UINT messa
On Friday, 28 February 2020 at 09:25:58 UTC, Виталий Фадеев wrote:
Yes. Thank !
I read it.
Problem is - OS has many messages + user messages... It mean
what interfaces like IKeyDown must me declared. All. Dream on
write less code...
So let's create a template for that:
interface IMessageHand
On Friday, 28 February 2020 at 10:33:11 UTC, Виталий Фадеев wrote:
Thanks all !
I happy !
Check this one:
void On( T, M )( T o, M message )
{
[snip]
void main()
{
auto a = new A();
a.Send( a, WM_KEYUP );
a.Send( a, WM_KEYDOWN );
}
That does mostly w
On Thursday, 5 March 2020 at 08:35:52 UTC, drug wrote:
On 3/5/20 10:47 AM, mark wrote:
In Adam Ruppe's D Cookbook there're these lines in a ref
counting example:
RefCountedObject o = void; // What does this mean/do?
o.data = new Implementation();
o.data.refcount = 1;
I don't understand the fi
On Saturday, 7 March 2020 at 15:44:38 UTC, Arine wrote:
The case when there isn't a value should be handled explicitly,
not implicitly. Propogating a None value
isn't useful
Except when it is useful, and shouldn't be handled explicitly. I
have code in D, C and C++ that looks like this:
On Monday, 9 March 2020 at 09:25:31 UTC, Calvin P wrote:
Is this a bugs ?
==
struct A {
ref auto opCall(string tmp) scope return {
return this;
}
}
struct B {
A _a;
@property ref auto a() scope return {
return _a;
On Tuesday, 10 March 2020 at 08:13:19 UTC, mark wrote:
I have this struct:
struct Deb {
string name;
...
Unit[string] tags; // set of tags
Deb dup() const {
Deb deb;
deb.name = name;
...
foreach (key; tags.byKey)
deb.tags[key] = unit;
On Tuesday, 10 March 2020 at 20:03:21 UTC, mark wrote:
I've managed to make a cut-down version that's < 170 LOC.
It needs to be run on Debian or a Debian-based Linux (e.g.,
Ubuntu).
Hopefully this will help someone understand and be able to help!
This took some time figuring out. Turns out,
On Wednesday, 11 March 2020 at 09:29:54 UTC, mark wrote:
Hi Simen,
I think you must have done something else but didn't mention to
get it to compile. I did the exact changes you said and it
wouldn't compile. Here's what I get with changes mentioned
below (with new full source):
Fascinating.
On Wednesday, 11 March 2020 at 12:43:28 UTC, mark wrote:
On Wednesday, 11 March 2020 at 12:22:21 UTC, Simen Kjærås wrote:
On Wednesday, 11 March 2020 at 09:29:54 UTC, mark wrote:
[snip]
Fascinating. It works just fine when compiling for 32-bit
targets with DMD on Windows, but not for 64-bit ta
On Thursday, 12 March 2020 at 08:51:24 UTC, mark wrote:
I use sets a lot and since I believe that D's rbtree is O(lg n)
for add/remove/in and that D's AA is O(1) for these, I want to
implement a set in terms of an AA.
Below is the code I've got so far. It allows for add and
remove. However, i
On Sunday, 15 March 2020 at 20:18:03 UTC, James Blachly wrote:
I would like to programmatically retrieve members of a subclass
to create a self-documenting interface. I am afraid that my
approach is not possible due to need for compile time __traits
/ std.traits, and runtime typeinfo. My propos
On Sunday, 29 March 2020 at 14:04:53 UTC, TodNaz wrote:
Hello!
class A
{
...
}
class B : A
{
...
}
class C : A
{
...
}
A example1;
B example2 = new B(...);
A = example2;
auto heir = A.whoheir(); ///
The question in this code is: is it possible to track the class
inheritor? Or is i
On Friday, 17 April 2020 at 08:59:19 UTC, kdevel wrote:
On Friday, 17 April 2020 at 04:29:06 UTC, Meta wrote:
Unlike C/C++, char is not a numeric type in D; It's a UTF-8
code point:
Thanks, it's a code /unit/. main reads now:
void main ()
{
bar!ubyte;
bar!byte;
bar!ushort;
bar!sho
On Friday, 17 April 2020 at 16:54:42 UTC, Adam D. Ruppe wrote:
This part seems fine...
pragma(msg, ParameterDefaults!f.stringof);
It is this, specifically, that causes the problem. Replace it
with:
void main() {
import std.stdio;
writeln(ParameterDefaults!f.stringof);
}
an
On Wednesday, Friday, 17 Apr 2020 17:45:47 UTC, H. S. Teoh wrote:
I wonder if the ultimate cause of the above case is ultimately
caused by
the change to import semantics that hid private symbols from
outside the
module. Perhaps something, somewhere, is triggering an illegal
access of
a private
On Saturday, 18 April 2020 at 09:19:48 UTC, Simen Kjærås wrote:
On Wednesday, Friday, 17 Apr 2020 17:45:47 UTC, H. S. Teoh
wrote:
I wonder if the ultimate cause of the above case is ultimately
caused by
the change to import semantics that hid private symbols from
outside the
module. Perhaps s
On Saturday, 18 April 2020 at 15:47:38 UTC, Marcone wrote:
How convert String to Hex?
Example:
string text = "Hello World"; // Converted to Hex =
48656c6c6f20576f726c64
import std.format : format;
string hex = format("%(%2x%)", "Hello World");
import std.stdio : writeln;
wr
On Wednesday, 29 April 2020 at 08:34:53 UTC, Ogi wrote:
struct R {}
int front(R r) { return 42; }
void popFront(R r) {}
bool empty(R r) { return false; }
void main() {
import std.range.primitives : isInputRange;
static assert(isInputRange!R);
}
Error: static assert: `isInputRange!(R)`
On Wednesday, 29 April 2020 at 09:16:58 UTC, user1234 wrote:
The static checker doesn't see your free funcs because to do so
it would have to import the whole module. (is it possible to do
that ? no idea.)
Of course it's possible! :) We can find the context of R (in this
case, the module) wit
On Wednesday, 29 April 2020 at 20:43:20 UTC, Casey wrote:
void popFront()
{
}
I mean, it might be you messed up in posting this, but having an
empty popFront and expecting it to do something is a tad
optimistic.
Apart from that, it seems like
On Thursday, 30 April 2020 at 13:23:25 UTC, Paul Backus wrote:
On Thursday, 30 April 2020 at 13:04:47 UTC, Casey wrote:
Here's a minimal code example that duplicates the issue:
import std.array, std.range, std.stdio, std.traits, std.string;
auto readStream(Range)(auto ref Range r) if
(isInput
On Friday, 1 May 2020 at 20:28:58 UTC, Jean-Louis Leroy wrote:
Is it possible, inside a function template, to create an alias
to the instantiated function? IOW the equivalent of
__FUNCTION__, but yielding an alias?
The closest I came is:
import std.string;
import std.traits;
void foo(T
On Tuesday, 5 May 2020 at 04:02:06 UTC, RazvanN wrote:
truct K
{
~this() nothrow {}
}
void main()
{
static class C
{
this(K, int) {}
}
static int foo(bool flag)
{
if (flag)
throw new Exception("hello");
return 1;
}
try
{
On Thursday, 7 May 2020 at 09:22:28 UTC, learner wrote:
Good morning,
Is there a reason why std.variant.visit is not inferring pure?
```
void test() pure {
Algebraic!(int, string) alg;
visit!( (string) => 0, (int) => 0)(alg);
}
Error: pure function test cannot call impure function
tes
On Thursday, 7 May 2020 at 10:21:07 UTC, Dukc wrote:
Is there some way to measure the performance of a function so
that the results will be same in different computers (all x86,
but otherwise different processors)? I'm thinking of making a
test suite that could find performance regressions
aut
On Friday, 8 May 2020 at 12:38:51 UTC, Marcio Martins wrote:
Hi,
I am building a CRC32C implementation using SSE for D, because
I couldn't find any readily available :[
However, I am unable to find any documentation regarding which
SSE instructions are available and how I could use them in D
On Friday, 8 May 2020 at 13:09:49 UTC, kinke wrote:
On Friday, 8 May 2020 at 12:49:00 UTC, Simen Kjærås wrote:
How would I go about calling _mm_* functions in D in a way
that is portable between D compilers?
You would use core.simd:
Nope one wouldn't, because that horrible interface isn't
s
On Saturday, 9 May 2020 at 19:54:44 UTC, Pavel Shkadzko wrote:
I have been reading about memory management in D on
https://wiki.dlang.org/Memory_Management and found an example
of a free list (pattern?): "Free lists are a great way to
accelerate access to a frequently allocated and discarded
t
On Monday, 11 May 2020 at 11:20:51 UTC, Joel wrote:
I'm gotten stuck with this error - "..is not visible from
module.."
Without some code it's hard to say exactly, but this generally
means you're referencing a private symbol in a different module:
module foo;
private struct S {}
module bar;
On Monday, 11 May 2020 at 12:44:45 UTC, Jack Applegame wrote:
On Monday, 11 May 2020 at 12:30:22 UTC, Adam D. Ruppe wrote:
UFCS is only defined to work with global scope functions. A
restricted import (module : symbol, symbols) puts things in
local scope so ufcs doesn't apply.
But in this cas
On Wednesday, 20 May 2020 at 13:51:05 UTC, Steven Schveighoffer
wrote:
Please file an issue.
https://issues.dlang.org/show_bug.cgi?id=20850
--
Simen
On Sunday, 24 May 2020 at 08:57:28 UTC, Luis wrote:
dmd ignores @trusted or @safe on opEquals, throwing this error :
onlineapp.d(27): Error: @safe function
onlineapp.__unittest_L24_C7 cannot call @system function
object.opEquals
An override @system or @trusted function can't be @safe, or I
On Wednesday, 27 May 2020 at 11:03:51 UTC, BoQsc wrote:
I'm lacking knowledge on how to achieve what I want and getting
an error.
What is the correct way to do what I tried to achieve in this
code?
Everything was intuitive until I started to add notice variable
to the writeln. Rdmd says variab
On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. wrote:
You can use this template:
enum Exists(alias T) = is(typeof(T));
I don't know if there's a faster way bu this technic is used,
notatbly in phobos, to workaroud issues of double declaration
in `static foreach`
enum Exists(alias T)
On Wednesday, 3 June 2020 at 15:25:51 UTC, Paul Backus wrote:
On Wednesday, 3 June 2020 at 13:24:17 UTC, Basile B. wrote:
This is because the template parameter must be resolved to a
valid symbol or type.
This version other version bypass the problem:
---
enum Exists(string s) = is(typeof(mixi
On Monday, 8 June 2020 at 06:13:36 UTC, mw wrote:
Hi,
I have this program:
import std.stdio;
void f(ref int[] arr) {
arr ~= 3;
}
void main() {
int[][] arrs;
int[] arr;
foreach (i; 0 .. 3) {
arr
On Monday, 8 June 2020 at 07:35:12 UTC, adnan338 wrote:
Self* searchTree(this Self)(auto in ref T item) const {
if (&this is null)
return null;
if (this.item == item)
return &this;
return (this.item < item) ?
this.right.searchTree(it
On Monday, 8 June 2020 at 09:08:40 UTC, adnan338 wrote:
On Monday, 8 June 2020 at 08:10:19 UTC, Simen Kjærås wrote:
On Monday, 8 June 2020 at 07:35:12 UTC, adnan338 wrote:
Self* searchTree(this Self)(auto in ref T item) const {
if (&this is null)
return null;
if
On Wednesday, 17 June 2020 at 11:50:27 UTC, Per Nordlöw wrote:
Should a range-compliant aggregate type realizing a parser be
encoded as a struct or class? In dmd `Lexer` and `Parser` are
both classes.
In general how should I reason about whether an aggregate type
should be encoded as a struct
On Thursday, 18 June 2020 at 14:43:54 UTC, H. S. Teoh wrote:
I have an array of input data that I'm looping over, and, based
on some condition, generate new items that are appended onto a
target array (which may already contain data). Since the
creation of new items is quite expensive, I'm thin
On Tuesday, 23 June 2020 at 04:01:45 UTC, Denis wrote:
(1) Assign an unused value for the flag (e.g. -1 when the
function returns an int), and return the combined value/flag.
This happens in some Phobos algorithms, and might be the most
common on this list.
(2) Return a tuple with the valu
On Friday, 26 June 2020 at 13:21:25 UTC, drathier wrote:
How can I tell the compiler that I will never create a value of
type X, while still being able to write code that uses it?
Using void as a template parameter is where I started, but I
still need to be able to declare variables inside this
On Tuesday, 30 June 2020 at 08:15:54 UTC, aberba wrote:
On Tuesday, 30 June 2020 at 00:33:41 UTC, Ali Çehreli wrote:
On 6/29/20 4:34 PM, aberba wrote:
> So with this, without the Thread.sleep() to block main from
exiting, the
> spawned thread will terminate immediately.
You can call core.thre
On Tuesday, 30 June 2020 at 13:44:38 UTC, aberba wrote:
On Tuesday, 30 June 2020 at 12:48:32 UTC, Simen Kjærås wrote:
On Tuesday, 30 June 2020 at 08:15:54 UTC, aberba wrote:
On Tuesday, 30 June 2020 at 00:33:41 UTC, Ali Çehreli wrote:
On 6/29/20 4:34 PM, aberba wrote:
> So with this, without
On Tuesday, 30 June 2020 at 12:18:14 UTC, Steven Schveighoffer
wrote:
I can see where it would be confusing, and it could probably
contain an example and clarification.
https://issues.dlang.org/show_bug.cgi?id=20997
On Wednesday, 1 July 2020 at 07:26:44 UTC, Anthony wrote:
When doing interop with a c library, is there a way to
automatically generate the fields that are needed for a struct?
[snip]
Is there an easier way though?
Dstep is probably what you're looking for:
https://github.com/jacob-carlborg/
On Wednesday, 1 July 2020 at 07:52:28 UTC, AB wrote:
Hello. I am unsure how to proceed about printing progress in my
program.
Suppose the program is processing a very big file and is
iterating the file's bytes using a for loop. The processing
takes several minutes and I want a progress percen
On Thursday, 9 July 2020 at 12:12:06 UTC, wjoe wrote:
I'm not considering supposed performance benefits/penalties
because these need to be profiled.
Considering the many downsides why would I ever want to choose
a static over a dynamic array ?
Simply put: static arrays are not dynamic arrays
On Friday, 10 July 2020 at 10:13:23 UTC, wjoe wrote:
However stack memory needs to be allocated at program start. I
don't see a huge benefit in allocation speed vs. heap
pre-allocation, or is there?
I mean 1 allocation vs 2 isn't going to noticeably improve
overall performance.
You seem to st
On Tuesday, 21 July 2020 at 13:42:15 UTC, Steven Schveighoffer
wrote:
On 7/21/20 8:34 AM, Adam D. Ruppe wrote:
The others aren't wrong about stack size limits playing some
role, but the primary reason is that it is a weird hack for
@safe, believe it or not.
...
I don't recall exactly when thi
On Wednesday, 5 August 2020 at 09:05:36 UTC, Flade wrote:
I have used an if-else statement to create an alias to avoid
code duplication but it doesn't let me access it outside the if
statement. Is there a way to solve this?
You're probably looking for static if:
static if (useAlias) {
On Wednesday, 5 August 2020 at 09:32:58 UTC, Flade wrote:
Thanks! You see it should work but the thing is. I'm using it
inside a function. I'm checking for one of the function's
parameter (if parameter == false) and it says that "the
variable `parameter` cannot be read at compile time. Do you
On Saturday, 15 August 2020 at 23:59:36 UTC, Joel wrote:
../../JMiscLib/source/jmisc/base.d(176,2): Error: @safe
function jmisc.base.upDateStatus!string.upDateStatus cannot
call @system function
std.stdio.makeGlobal!"core.stdc.stdio.stdout".makeGlobal
/Library/D/dmd/src/phobos/std/stdio.d(4837,
On Monday, 17 August 2020 at 08:07:32 UTC, novice3 wrote:
Hello.
I have wrapping Windows API functions, wich return 0 on success
and erroro code on failure.
I copy wenforce template as:
```
private T denforce(T, S)(T value, lazy S msg = null, string
file = __FILE__, size_t line = __LINE__)
{
On Monday, 17 August 2020 at 21:18:41 UTC, Per Nordlöw wrote:
I'm using
pragma(msg, __FILE__, "(", __LINE__, ",1): Debug: ", "A
useful debug message");
to print compile-time information formatted as standard
compiler diagnostics.
These are picked up by Emacs Flycheck and overlayed in t
On Tuesday, 18 August 2020 at 08:05:20 UTC, Per Nordlöw wrote:
On Tuesday, 18 August 2020 at 08:03:04 UTC, Per Nordlöw wrote:
Forgot to mention that I want to support variadic arguments to
`ctLog` similar to what is done with
And these arguments should be of any template argument kind,
not on
On Friday, 28 August 2020 at 08:16:01 UTC, Alexandru Ermicioi
wrote:
Hi everyone,
there is https://issues.dlang.org/show_bug.cgi?id=21180 bug,
anyone knows how to avoid it?
Test case:
-
import std;
class Silly {
bool opEquals(const Silly silly) const @safe {
return si
On Friday, 28 August 2020 at 10:42:09 UTC, Alexandru Ermicioi
wrote:
No that is not a solution at all, in template code that
requires safety. You basically will have to sacrifice safety
for rest of types, such as structs, unions & enums for the sake
of objects being able to compare.
Yup. Ther
On Friday, 28 August 2020 at 13:35:43 UTC, Alexandru Ermicioi
wrote:
On Friday, 28 August 2020 at 12:29:20 UTC, Simen Kjærås wrote:
Seems that these methods should be rooted out from Object, and
placed in respective interfaces like:
-
interface Equatable(T) {
bool opEquals(T va
On Tuesday, 1 September 2020 at 02:08:54 UTC, JG wrote:
Is there anyway to remove the boilerplate code of dealing with
tuples:
I find myself having to write things like this fairly often
auto someRandomName = f(...); //where f returns a tuple with
two parts
auto firstPart = someRandomName[0
On Friday, 4 September 2020 at 10:16:47 UTC, 60rntogo wrote:
Consider the following code.
foo.d
---
module foo;
struct Foo
{
private int i;
}
---
main.d
---
void main()
{
import std.stdio;
import foo;
auto x = Foo();
writeln(x);
// ++x.i;
++x.tupleof[0];
writeln(x);
}
---
As
1 - 100 of 312 matches
Mail list logo