On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
Hi,
```d
import std;
void main() {
int val = 4;
enum prog = q{
(){ val += 1; return val; }()
};
//mixin(prog); //
auto dummy = mixin(prog); //Must capture the return value,
otherwise it hallucinates EOF.
On Tuesday, 13 August 2024 at 19:40:30 UTC, IchorDev wrote:
On Monday, 12 August 2024 at 15:23:31 UTC, Stefan Koch wrote:
It's about 12.000 lines of code.
I am not sure how much has rotted away, I last touched it in
2021.
The relevant files would be:
the bytecode interpreter:
On Monday, 12 August 2024 at 11:26:50 UTC, IchorDev wrote:
On Tuesday, 2 July 2024 at 16:46:11 UTC, Jonathan M Davis wrote:
It really is a shame that "newCTFE" was never completed.
I didn’t know about this. I thought a new CTFE engine was
actually implemented a few years ago. Is ‘newCTFE’ too
On Thursday, 25 January 2024 at 15:39:08 UTC, ryuukk_ wrote:
```D
void main()
{
char[32] id = 0;
id = "hello";
}
```
this works fine, and that is what i expect for the example
above..
Raise a bug, I'll fix it.
On Saturday, 2 December 2023 at 05:16:43 UTC, name wrote:
Minimum thing to reproduce bug:
main.d:
```d
import test;
void main() {
auto a = FILE_MAP_READ;
}
```
test.c
```c
#define SECTION_MAP_READ 0x0004
#define FILE_MAP_READ SECTION_MAP_READ
```
build with
```"D:\dmd.2.105.3.windows\
On Tuesday, 27 December 2022 at 12:22:45 UTC, Johan wrote:
does semantic analysis (create AST; note that there is a ton of
calls needed to complete SeMa), and finally outputs object code.
If you want to capitalize the word use SemA. ;)
On Sunday, 4 December 2022 at 09:54:53 UTC, Salih Dincer wrote:
Recently DIP1044 was published about enum and although we can
use `with()` instead we waste time unnecessarily...
With cannot be used in calls.
Hence when calling a function you need to either spell out the
enum type or wrap the c
On Sunday, 22 May 2022 at 23:35:11 UTC, mw wrote:
On Sunday, 22 May 2022 at 22:37:43 UTC, Stefan Koch wrote:
On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:
Does D language have task steal queue?
The requirements are high-performance, lock-free, and
thread-safe.
I have one called
On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:
Does D language have task steal queue?
The requirements are high-performance, lock-free, and
thread-safe.
I have one called fluffy:
https://github.com/UplinkCoder/fluffy
I am not 100% sure about the performance I did try to make it
re
On Thursday, 6 January 2022 at 12:04:12 UTC, HuskyNator wrote:
On Monday, 28 November 2016 at 14:41:44 UTC, Era Scarecrow
wrote:
On Monday, 28 November 2016 at 09:06:34 UTC, Paolo Invernizzi
wrote:
The point is that I was trying to avoid some cycle between
modules, detected by 2.072. This bug l
On Tuesday, 9 November 2021 at 21:03:20 UTC, Steven Schveighoffer
wrote:
On 11/9/21 3:05 PM, Stefan Koch wrote:
Yes it is valid C.
It is not valid D though.
The file is named `tomld.c`
The way importC works is, you pass a .c file to the compiler,
and it treats it as C.
-Steve
It
On Tuesday, 9 November 2021 at 19:53:48 UTC, Steven Schveighoffer
wrote:
On 11/9/21 2:34 PM, Stefan Koch wrote:
On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote:
[...]
What's happening here is that dmd seems to see `free` as
function rather than a pointer to a function.
cha
On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote:
```
toml.c(39): Error: cannot implicitly convert expression
`malloc` of type `extern (C) void*(ulong __size)` to `extern
(C) void* function(ulong)`
toml.c(40): Error: cannot implicitly convert expression `free`
of type `extern (C) voi
On Thursday, 16 September 2021 at 20:53:34 UTC, Elmar wrote:
Hello D community.
I was browsing the `__traits` keywords and I found `isFuture`
whose descriptions says something about `@future`-annotated
variables.
[link](https://dlang.org/spec/traits.html#isFuture)
I didn't find anything abo
On Friday, 27 August 2021 at 02:17:21 UTC, Merlin Diavova wrote:
On Friday, 27 August 2021 at 02:10:48 UTC, Stefan Koch wrote:
On Friday, 27 August 2021 at 01:51:42 UTC, Merlin Diavova
wrote:
Hi all,
I'm Merlin, I'm just starting out in D and super excited.
My questions are:-
1.
On Friday, 27 August 2021 at 01:51:42 UTC, Merlin Diavova wrote:
Hi all,
I'm Merlin, I'm just starting out in D and super excited.
My questions are:-
1. In a range pipeline how does one handle the event of a
filter range returning empty?
2. How does one unwrap a single result from a range o
On Saturday, 14 August 2021 at 20:07:21 UTC, james.p.leblanc
wrote:
Good Evening/Day,
Suppose I have a number of function templates that each take
two types, say S and T.
I would like to exercise my routines over the combinations
of types:
set of all S: ( double[], float[], Complex!double[],
On Wednesday, 11 August 2021 at 06:29:40 UTC, Tejas wrote:
```d
import std;
void main()
{
int[40] staticA;
auto c = staticA[0..50];//mistake
}```
results in:
```d
core.exception.RangeError@onlineapp.d(5): Range violation
??:? _d_arrayboundsp [0x55db29a0b645]
./onlineapp.
On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote:
On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:
but, where's these switch option documented? it seems it not
appears in dmd --help or man dmd, or online document
https://dlang.org/dmd-linux.html
That's what he meant
On Monday, 26 July 2021 at 12:01:23 UTC, Adam D Ruppe wrote:
On Monday, 26 July 2021 at 11:43:56 UTC, workman wrote:
__FILE__[0..$]
Why do you have that [0..$] there? It is probably breaking the
__FILE__ magic.
Correct.
The compiler has to evaluate the default argument as constant
expressi
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.
There is your problem.
auto scheduler = new FiberScheduler;
The Fiber scheduler will spawn
On Thursday, 24 June 2021 at 07:28:56 UTC, kinke wrote:
On Thursday, 24 June 2021 at 06:50:44 UTC, Ola Fosheim Grøstad
wrote:
[...]
(I don't think I've ever seen one); with `scope c = new
Object`, you can have the compiler allocate a class *instance*
on the stack for you, but `c` is still a
On Saturday, 30 January 2021 at 23:34:50 UTC, Stefan Koch wrote:
this special version of dmd will generate a trace file which
can be read with the included printTraceHeader tool
you will want to take a look at the PhaseHist command which shows
you the compiler phase that took the most time
On Saturday, 30 January 2021 at 22:47:39 UTC, Ahmet Sait wrote:
I'm looking for ways to figure out what parts of the code slows
down the compiler other than brute force trial.
Can I use -vtemplates switch for this?
Would -v (verbose) switch helpful in some way?
How would I know if my bottleneck
this to a string succeeds (compiler does not complain)
with
me32.szExePath.text
However, comparing this with the result of thisExePath()
(std.file) never succeeds although the two string values when
written with writeln() appear to be the same.
This drives me crazy!
Any ideas?
Tschüß,
Stefan
On Saturday, 5 December 2020 at 02:59:58 UTC, Paul Backus wrote:
On Saturday, 5 December 2020 at 00:57:04 UTC, Stefan Koch wrote:
Hi,
today I've been dusting my SDC fork and implemented a
rudimentary version of pragma(msg).
I could pragmaStatement
as in void f()
{
pragma(msg, typ
under declaration,
pragma is not.
Maybe it's stated differently?
Any help is appreciated.
Cheers,
Stefan
On Friday, 20 November 2020 at 14:08:23 UTC, jmh530 wrote:
Doing something like below fails because I don't seem to be
able to make a templated lambda that just takes types. Is the
only way to do something similar to create a separate function
to handle the condition, or is there some other way
On Thursday, 22 October 2020 at 18:33:52 UTC, Ola Fosheim Grøstad
wrote:
In general, it is hard to tell if a computation is long-running
or unsolvable.
You could even say ... it's undecidable :)
On Wednesday, 30 September 2020 at 08:33:58 UTC, Frak wrote:
On Tuesday, 29 September 2020 at 18:25:03 UTC, Steven
Schveighoffer wrote:
On 9/29/20 1:08 PM, Frak wrote:
[...]
Because it's probably coming from a constraint, you probably
can't figure out the exact usage. What's more annoying is
https://forum.dlang.org/post/ptgud7$16f6$1...@digitalmars.com
On Monday, 26 November 2018 at 14:02:15 UTC, Andrei Alexandrescu
wrote:
On 11/26/18 4:04 AM, Per Nordlöw wrote:
Why is there no
- __traits(isArray, T)
alongside
- __traits(isStaticArray, T) and
- __traits(isAssociativeArray, T)
On Wednesday, 15 July 2020 at 13:38:34 UTC, Cecil Ward wrote:
I recently noticed
pragma(inline, true)
which looks extremely useful. A couple of questions :
1. Is this cross-compiler compatible?
2. Can I declare a function in one module and have it _inlined_
in another module at the call si
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 Tuesday, 9 June 2020 at 23:53:16 UTC, Q. Schroll wrote:
Is there any particular reason why std.range : enumerate is a
thing and
[...]
I don't think there is any particular reason. Other than that
might shadow an opApply.
And C++ iterators didn't have it.
On Thursday, 4 June 2020 at 14:20:45 UTC, Q. Schroll wrote:
On Thursday, 4 June 2020 at 09:03:40 UTC, Simen Kjærås wrote:
string exists(string s) {
return "__traits(compiles, { mixin(\"alias _ = "~s~";\");
})";
}
Little nitpicking, but D has many forms of string literals.
Escaping is ha
On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. wrote:
On Wednesday, 3 June 2020 at 09:03:22 UTC, drathier 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 issu
On Monday, 4 May 2020 at 17:00:21 UTC, Anonymouse wrote:
TL;DR: Is there a way to tell what module or other section of a
codebase is eating memory when compiling?
I'm keeping track of compilation memory use using zsh `time`
with some environmental variables. It typically looks like this.
```
On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer
wrote:
I'm building a library that uses vibe-core as an indirect
dependency. Specifically, I'm testing the library with dub test.
[...]
Those are signed unsigned mismatches when it tries to lock.
that's probably in vibe-d
On Thursday, 9 April 2020 at 20:56:59 UTC, Johan wrote:
On Thursday, 9 April 2020 at 20:42:18 UTC, Stefan Koch wrote:
Simple question, how do I keep the GC from spawning threads?
Cheers,
Stefan
https://dlang.org/changelog/2.087.0.html#gc_parallel
Thanks a lot.
Simple question, how do I keep the GC from spawning threads?
Cheers,
Stefan
On Sunday, 5 April 2020 at 22:24:27 UTC, solidstate1991 wrote:
My game engine is currently broken due to some race issue I
don't really know how to resolve.
It seems that the compiler tries to skip instructions that are
not locked with a `writeln()` or something similar. Usually I
can safely
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 Wednesday, 26 February 2020 at 00:50:35 UTC, Basile B. wrote:
So after reading the translation of RYU I was interested too
see if the decimalLength() function can be written to be
faster, as it cascades up to 8 CMP.
[...]
It can be made faster using binary search. Not by much though.
You
On Saturday, 22 February 2020 at 12:24:56 UTC, drathier wrote:
On Saturday, 22 February 2020 at 11:53:38 UTC, Dennis wrote:
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw
wrote:
Is there a dmd flag that shows the code after template
instantiations has been performed?
The -vcg-ast
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote:
We're looking for a way to speed up compilation of
template-heavy code. So we are trying to find out which parts
of the code that is most costly to compile.
Is there a dmd flag that shows the code after template
instantiations
On Friday, 21 February 2020 at 09:03:26 UTC, Abby wrote:
On Monday, 17 February 2020 at 19:02:50 UTC, Stefan Koch wrote:
Sorry I just realized I never published the code.
I am going to add it to ctfeutils.
Hi Stefan,
I'm sorry to bother you, I just wanted to kindly ask if you
would u
On Tuesday, 18 February 2020 at 03:33:21 UTC, Basile B. wrote:
On Monday, 17 February 2020 at 22:34:31 UTC, Stefan Koch wrote:
Upon seeing this I just implemented typeid(stuff).name;
https://github.com/dlang/dmd/pull/10796
With any luck this will be possible in the next release ;)
Can this
On Monday, 17 February 2020 at 18:49:55 UTC, Steven Schveighoffer
wrote:
On 2/17/20 2:28 AM, Nathan S. wrote:
What I want is something like this:
string className(in Object obj) {
return obj is null ? "null" : typeid(obj).name;
}
...except I want it to work in CTFE. What is the
On Monday, 17 February 2020 at 11:51:03 UTC, Abby wrote:
On Monday, 17 February 2020 at 11:05:46 UTC, Stefan Koch wrote:
On Monday, 17 February 2020 at 10:18:32 UTC, Abby wrote:
[...]
I have a ctfe compatible string formatter, you should be to
find it here
https://forum.dlang.org/post
find
it here
https://forum.dlang.org/post/hmyxvknbdqtlnxvqq...@forum.dlang.org
I hope that helps,
Regards, Stefan
:
On Sunday, 16 February 2020 at 13:48:43 UTC, Виталий Фадеев wrote:
Possible mark variable for force use register ?
Example C-code:
{
register char *buf;
long pos;
register int n;
register int r;
if (!n)
return 0;
}
How to implement in D ?
Don't you
On Thursday, 26 May 2005 at 20:41:10 UTC, Vathix wrote:
The problem is that D's main() initializes things. Using a C
main() bypasses that startup code. Put the main() in the D file
(with D extern) and have it call a function in the C file that
you will treat as main.
That's correct, but not
On Saturday, 2 November 2019 at 17:49:09 UTC, Luh wrote:
Hello,
When trying to pass a D function to the C callback, the
compiler says:
'Error: cannot implicitly convert expression &this.onProcessCb
of type extern (C) bool delegate(const(short*) a, ulong b,
void* c) to extern (C) bool functi
On Wednesday, 23 October 2019 at 12:01:47 UTC, Per Nordlöw wrote:
On Wednesday, 23 October 2019 at 11:33:56 UTC, kinke wrote:
For your example, the template is inferred to be @safe, and
`-release` only elides bounds checks in @system functions
(corresponding to `-boundscheck=safeonly`). Use
`-
On Monday, 14 October 2019 at 16:02:28 UTC, Marcel wrote:
It appears that the ABI specification only describes the
register convention for x86. Where can I find which registers
get preserved across function calls for 64-bit targets?
It's the same as c++.
https://en.wikipedia.org/wiki/X86_call
On Saturday, 21 September 2019 at 13:42:09 UTC, Bogdan wrote:
Well, this seems to be working:
float[4] doSimd(float[4] values, float delta)
{
float4 v_delta = delta;
float4 v_values = __simd(XMM.ADDPS,
__simd(XMM.LODAPS, values[0]),
v_d
On Friday, 6 September 2019 at 15:09:22 UTC, Max Samukha wrote:
Consider the following two modules:
1. test.d:
module test;
import lib.a;
void main() {
foo();
}
2. lib/a.d:
module lib.a;
extern(C) void foo() {}
When compiled separately (dmd -c lib/a.d; dmd test.d a.o), the
function
On Thursday, 22 August 2019 at 18:10:51 UTC, jicman wrote:
Greetings!
Is there any tool out there, I searched around and didn't find
any, that would take ton of D1 code and convert it to D2?
Thanks.
josé
There is:
https://github.com/sociomantic-tsunami/d1to2fix
It might be please ask an
On Saturday, 17 August 2019 at 19:43:22 UTC, Giovanni Di Maria
wrote:
Hi,
i have seen that a simple operation (in a loop) is faster than
the equivalent UDF.
The first example takes 4 seconds, the second example takes 16
seconds.
Local variables influence the speed of execution?
Thank you very
On Monday, 15 July 2019 at 13:40:29 UTC, Ben Ogles wrote:
I have written a simple function that can call another function
over integral types with random arguments:
[...]
You cannot. meta-programming and compile-time evaluation are
supposed to be deterministic,
and hence cannot take random
On Friday, 12 July 2019 at 22:46:11 UTC, Anonymouse wrote:
I'm suddenly getting segfaults when running tests on Windows.
It works fine on Linux. I reduced it to a few lines (plus a
dependency) with dustmite, but they don't really make sense[1].
Nevertheless they do trigger the segfault.
Can s
On Saturday, 18 May 2019 at 16:35:44 UTC, Robert M. Münch wrote:
I want to profile my windows app which has a WinMain(). One of
the first statements in WinMain() within a try{} is:
Runtime.initialize();
But when I compile my app with -profile, it crashes on entry of
WinMain(). Looks like this
On Wednesday, 15 May 2019 at 13:08:18 UTC, Bogdan wrote:
I don't have any experience with using templates. Is it
possible to create a RB tree containing structs, where the
nodes are ordered by one struct member?
```
import std.stdio;
import std.container;
enum KeyID: uint
{
KEY_A,
On Tuesday, 14 May 2019 at 08:26:41 UTC, Steven Schveighoffer
wrote:
On 5/13/19 9:39 PM, Steven Schveighoffer wrote:
Does anyone have a good answer for why this should happen, or
should I file a bug?
It's been mentioned to me that type inference is used here.
However, one could argue that t
On Thursday, 2 May 2019 at 02:54:03 UTC, Andrey wrote:
Hello, I have got this code:
[...]
I want to sort array of tuples using "data" element in CTFE.
But this code give me errors:
[...]
As I understand the function "sort" sometimes can't be run at
CT because of reinterpreting cast.
On Monday, 22 April 2019 at 08:02:06 UTC, Arun Chandrasekaran
wrote:
What am I doing wrong here?
struct A
{
union B
{
int bb;
}
B b;
alias aa = B.bb;
}
void main()
{
A a = A();
// a.b.bb = 4; // works
a.aa = 4; // fails
}
https://run.dlang.io/is/kXaVy2
On Thursday, 4 April 2019 at 10:31:43 UTC, Julian wrote:
On Thursday, 4 April 2019 at 09:57:26 UTC, rikki cattermole
wrote:
If you need performance use ldc not dmd (assumed).
LLVM has many factors better code optimizes than dmd does.
Thanks! I already had dmd installed from a brief look at D
)
I'd be intereseted in your usecases, so I can asses the
requirements better.
Thanks in advance!
- Stefan
On Wednesday, 27 February 2019 at 17:23:21 UTC, Q. Schroll wrote:
I have a template function `fImpl` I whish to instantiate
manually using the new name `f`. Reason is simple: `f` should
not be a template, but overloading it makes it easier that way.
Nothing's more simple in D:
[...]
the stru
On Thursday, 14 February 2019 at 23:55:18 UTC, SimonN wrote:
std.typecons.Rebindable!(immutable A) is implemented as:
private union {
immutable(A) original;
A stripped;
}
...@trusted assignment operators...
@property inout(immutable(A)) get() @trusted pure nothr
On Tuesday, 22 January 2019 at 16:47:45 UTC, FrankLike wrote:
On Tuesday, 22 January 2019 at 16:18:17 UTC, Adam D. Ruppe
wrote:
Use "mystring"w, notice the w after the closing quote.
Or toStringz is not work like c_str() in C++?
stringz creates a char*
but you need a wchar*
On Monday, 7 January 2019 at 13:15:44 UTC, Andre Pany wrote:
On Monday, 7 January 2019 at 13:01:57 UTC, Stefan Koch wrote:
On Monday, 7 January 2019 at 12:19:57 UTC, Andre Pany wrote:
[...]
From the function declaration &model seems to be the correct
thing to use here.
Have you che
On Monday, 7 January 2019 at 12:19:57 UTC, Andre Pany wrote:
Hi,
I call a C function from a dll (SO on linux). While the
following code works
fine for DMD on windows, there are strange errors for LDC on
windows. Also the equivalent code does not work for DMD/LDC on
linux.
(When calling other
On Sunday, 6 January 2019 at 21:53:31 UTC, Per Nordlöw wrote:
When converting a single integer to a string is `formatValue`
preferred over `formattedWrite` in terms of compilation and
run-time performance?
I've written my own itos function because using std.conv was too
expensive.
see
https:
On Friday, 4 January 2019 at 11:45:24 UTC, Jacob Shtokolov wrote:
On Friday, 4 January 2019 at 10:34:07 UTC, Basile.B wrote:
Show us some code.
Here is the simple example:
https://run.dlang.io/gist/1a06dd703bea5548ee72b4713a7ce5f6
The thing I'm trying to do is to make an experimental port (f
On Tuesday, 18 December 2018 at 12:21:44 UTC, berni wrote:
Is there a way to check if a function is indeed executed at
compile time or not? (Other than going through the whole
executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but unf
written with CTFE in mind.
Maybe you can generate a finite automaton for your regex offline
using some other engine like which supports D or C.
That alone should cut a few seconds of your compile-times and
prevent out-of-memory errors,
I hope this helps.
Cheers,
Stefan
On Friday, 23 November 2018 at 08:57:57 UTC, Chris Katko wrote:
Any time I see people mention the benefits of D, I see "compile
times" "compile times" "compile times" over and over.
[...]
If you can share the code privately I can use my custom profiling
build of dmd to analyze the problem. j
On Thursday, 22 November 2018 at 15:38:18 UTC, Per Nordlöw wrote:
The natural way forward for D is to add static analysis in the
compiler that tracks use of possibly uninitialized classes (and
perhaps also pointers). This has been discussed many times on
the forums. The important thing with su
On Wednesday, 21 November 2018 at 10:47:35 UTC, NoMoreBugs wrote:
On Monday, 19 November 2018 at 21:39:22 UTC, Adam D. Ruppe
wrote:
On Monday, 19 November 2018 at 21:23:31 UTC, Jordi Gutiérrez
Hermoso wrote:
What's the reasoning for allowing this?
The mistake is immediately obvious when you r
On Friday, 2 November 2018 at 14:10:35 UTC, Richard Palme wrote:
My guess is that I have to build phobos with:
$make -f posix.mak BUILD=debug
but then what do I do next? I'm using Linux and I built
dmd+phobos manually by following this guide:
https://wiki.dlang.org/Building_under_Posix
Whic
a small patch to dmd.
Tell me which version are you using and I'll make it for you.
Cheers,
Stefan
On Wednesday, 12 September 2018 at 10:42:08 UTC, Josphe Brigmo
wrote:
x64 gives
Privileged instruction
but x86 gives
First-chance exception: std.file.FileException "C:\": The
filename, directory name, or volume label syntax is incorrect.
at std\file.d(4573)
which is much more informative.
On Monday, 3 September 2018 at 15:08:57 UTC, agorkvmh wrote:
On Monday, 3 September 2018 at 15:00:33 UTC, Alex wrote:
On Monday, 3 September 2018 at 14:00:23 UTC, agorkvmh wrote:
[...]
Yes. Put a pragma where you static assert for Foo(1).pos
equality with 2:
[...]
Thanks, by the way, the
On Thursday, 2 August 2018 at 08:30:05 UTC, Greatsam4sure wrote:
I know D is very powerful from my little experience. What is
the idiomatic way to get prime numbers say from 1-30 without
using loops(outer and inner loop). Can map, filter, fold etc in
algorithm be use. Pls show some code with c
On Tuesday, 24 July 2018 at 15:48:28 UTC, Vladimir Marchevsky
wrote:
After reading 2.081 patchnotes about improvements with binding
to cpp classes, I'm trying to test it - with simple examples
and Qt as cpp library.
My naive approach is to bind just a couple of used methods of
specific classe
On Thursday, 28 June 2018 at 09:26:10 UTC, Flaze07 wrote:
On Thursday, 28 June 2018 at 08:52:33 UTC, Simen Kjærås wrote:
On Thursday, 28 June 2018 at 08:36:54 UTC, Flaze07 wrote:
is there some sort of ways to turn range into tuple ? ( an
array preferably )
e.g
uint[] arr = [ 10, 20, 30 ];
auto
On Thursday, 28 June 2018 at 08:36:54 UTC, Flaze07 wrote:
is there some sort of ways to turn range into tuple ? ( an
array preferably )
e.g
uint[] arr = [ 10, 20, 30 ];
auto tup = rangeToTup( arr );
assert( tup[ 0 ] == 10 );
assert( tup[ 1 ] == 20 );
assert( tup[ 2 ] == 30 );
I think you are l
On Tuesday, 26 June 2018 at 09:14:11 UTC, Radu wrote:
Consider this https://run.dlang.io/is/HyY2qG
---
void main()
{
import std.traits;
size_t s;
pragma(msg, typeof(s).stringof);
pragma(msg, mangledName!(typeof(s)));
pragma(msg, mangledName!s);
}
---
It outputs:
---
ulong
m
On Sunday, 24 June 2018 at 18:21:09 UTC, rjframe wrote:
On Sun, 24 Jun 2018 14:43:09 +, Mr.Bingo wrote:
let is(CTFE == x) mean that x is a compile time constant.
CTFE(x)
converts a x to this compile time constant. Passing any
compile time
constant essentially turns the variable in to a co
On Sunday, 24 June 2018 at 14:16:26 UTC, Kamil Koczurek wrote:
I recently wrote a brainfuck compiler in D, which loads the BF
source at compile time, performs some (simple) optimizations,
translates everything to D and puts it into the source code
with a mixin.
I did manage to get some pretty
On Wednesday, 30 May 2018 at 23:07:26 UTC, Jonathan M Davis wrote:
newCTFE is taking a very different approach to CTFE, and in
theory, it will fix many of the problems that CTFE currently
has, but it's taking Stefan quite a while to get it to where it
needs to be to actually merge it.
On Tuesday, 12 June 2018 at 18:27:17 UTC, Dr.No wrote:
I'd like help of compiler to check this:
consider this:
int f(int n) {
m_n = n;
}
f(10); // ok
f(myTampleteFunction!(compileTimeParameter)); // ok
enum n = 10;
f(n); // I won't use this, but should also be ok
int x = 10;
f(x); // error
i
On Thursday, 7 June 2018 at 21:07:26 UTC, DigitalDesigns wrote:
class A;
class B
{
A a = new A();
}
auto b1 = new B();
auto b2 = new B();
assert(b1.a == b2.a)!!
I'm glad I finally found this out! This is not typical behavior
in most languages is it?
I'd expect it to be translated to so
On Tuesday, 5 June 2018 at 18:00:05 UTC, Steven Schveighoffer
wrote:
No, it's definitely a bug. main is not being evaluated at
compile time. The real result of this function should be a
compile-time error -- __ctfe is a *runtime* value that is
always defined based on whether you are __ctfe or
On Tuesday, 5 June 2018 at 13:27:35 UTC, Steven Schveighoffer
wrote:
On 6/5/18 6:40 AM, Simen Kjærås wrote:
On Tuesday, 5 June 2018 at 09:36:22 UTC, Gopan wrote:
void main()
{
immutable n = __ctfe ? 1 : 2;
int[n] a;
assert(a.length == n); // fails, wat
}
That's gotta be a bug - th
On Tuesday, 27 February 2018 at 14:32:54 UTC, King_DuckZ wrote:
... My problem is mixing D with C and C++ ...
you found already Dragos cmake-d, but not sure if you also know
Dragos talk about mixing D with C/C++.
If not, have a look:
https://gitlab.com/dcarp/MUCplusplus/tree/master/2016.01.2
On Saturday, 12 May 2018 at 20:23:27 UTC, boolangery wrote:
Hi,
I want to do something like that:
The user first register some type associated to a string and a
callback
registerHandler!Foo("foo", (res) {
info("message received");
});
I want the callback to be called when a json packet c
On Wednesday, 2 May 2018 at 12:38:25 UTC, Jonathan M. Wilbur
wrote:
I have a method that cannot be @nogc only because it
concatenates strings for a long exception message, as seen
below.
throw new ASN1ValuePaddingException
(
"This exception was thrown be
On Monday, 30 April 2018 at 12:35:06 UTC, Timoses wrote:
Hey,
reading through https://dlang.org/articles/const-faq.html and
experimenting a bit:
```
immutable int i = 3;
const(int)* p = &i;
int* q = cast(int*)p;
assert(q == p && p == &i);
writeln(i); // 3
*q = 1;
1 - 100 of 373 matches
Mail list logo