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.
I'm using very modest amounts of templates, for a fairly small
sized program (very early work toward a game),
On Saturday, 17 November 2018 at 17:58:54 UTC, John Chapman wrote:
The following code doesn't compile because the generated type
name needs to be available inside the mixin's scope, whereas
it's actually in another module.
auto makeWith(string className, Args…)(auto ref Args args) {
On Saturday, 17 November 2018 at 13:13:36 UTC, aliak wrote:
On Friday, 16 November 2018 at 13:21:39 UTC, Stanislav Blinov
wrote:
auto assumeNoGC(T)(return scope T t) @trusted { /* ... */ }
Sawweet! Thanks, that made the printing possible!
"scope" is const from what I understand right? It
On Saturday, 10 November 2018 at 06:56:29 UTC, Neia Neutuladh
wrote:
Is this right?
Are you sure you added @safe to the second example?
https://run.dlang.io/is/2RbOwK fails to compile.
On Friday, 2 November 2018 at 04:18:47 UTC, Neia Neutuladh wrote:
On Fri, 02 Nov 2018 04:01:00 +, Nicholas Wilson wrote:
By noting that all (interesting for the purpose of UDA's i.e.
not void)
types have a .init
or you could do
static if (is(typeof(uda) == Foo) || is(uda == Foo))
On Friday, 2 November 2018 at 03:13:19 UTC, Neia Neutuladh wrote:
On Fri, 02 Nov 2018 00:36:18 +, Nicholas Wilson wrote:
What do you do to handle this?
@Foo() int bar;
instead of
@Foo int bar;
Right. And if you're offering a library with UDAs for other
people to use?
I mean I
On Thursday, 1 November 2018 at 16:14:45 UTC, Neia Neutuladh
wrote:
The spec says that a user-defined attribute must be an
expression, but DMD accepts a wide range of things as UDAs:
Indeed UDA are odd beasts:
https://issues.dlang.org/show_bug.cgi?id=19127
What do you do to handle this?
On Thursday, 1 November 2018 at 23:59:26 UTC, kerdemdemir wrote:
I have two numbers
First The price = 0.0016123
Second Maximum allowed precision = 0.0001(it can be only
0.001, 0.0001, 0.1, ..., 0.01 bunch of zeros and
than a one that is it)
Anything more precise than
On Sunday, 28 October 2018 at 06:59:31 UTC, DanielG wrote:
For the benefit of anybody who encounters a problem like this
in the future ... originally I had my C library "header" files
(renamed from .di to .d after the feedback from Nicholas) in a
special 'headers/' subdir, used as an import
On Sunday, 28 October 2018 at 04:23:27 UTC, DanielG wrote:
On Sunday, 28 October 2018 at 03:39:41 UTC, Nicholas Wilson
wrote:
write struct Foo {
double bar = 0.0; // The bitpattern of 0.0 is 0
}
Thank you for your response.
Can you elaborate on 'write struct...'? Is that special syntax?
On Sunday, 28 October 2018 at 03:34:57 UTC, Neia Neutuladh wrote:
targetType "executable" does it for me (dub 1.11.0).
Can you post your full dub.sdl?
I'm an idiot, I was in the wrong directory that does seem to work.
On Sunday, 28 October 2018 at 03:28:20 UTC, DanielG wrote:
I'm wrapping a C library which has a lot of structs defined,
and I keep running into issues where dmd complains that .init
isn't defined ("Symbol Undefined __xxx__initZ" etc).
I'm struggling to narrow it down to a simple example
So I have a project that is a simple dub app with
source/
app.d
$dub
Performing "debug" build using /Library/D/dmd/bin/dmd for x86_64.
foo ~master: building configuration "application"...
Linking...
Running ./foo
Edit source/app.d to start your project.
$mv source/app.d source/foo.d
$dub
On Friday, 26 October 2018 at 01:58:47 UTC, Heromyth wrote:
Maybe it's better to extend core.thread.Thread by inheriting it.
Am I right? Thanks!
Yes, see the example at
https://dlang.org/phobos/core_thread.html#.Thread
On Wednesday, 17 October 2018 at 22:37:53 UTC, Stanislav Blinov
wrote:
On Wednesday, 17 October 2018 at 22:30:31 UTC, Jordan Wilson
wrote:
Ideally, I'd check args before I take the time to load up data.
https://dlang.org/phobos/core_runtime.html#.Runtime
Here I was looking through
Hello,
Is there a way to access command line arguments outside of main?
// main.d
module main;
import data;
void main(string args[]) {
}
// data.d
module data
immutable programData;
static this() {
// read in data
}
Ideally, I'd check args before I take the time to load up data.
On Monday, 15 October 2018 at 21:48:05 UTC, Vinay Sajip wrote:
On Monday, 15 October 2018 at 19:56:22 UTC, Nicholas Wilson
wrote:
import std.file : readText;
import std.uni : byCodePoint, byGrapheme;
// or import std.utf : byCodeUnit, byChar /*utf8*/, byWchar
/*utf16*/, byDchar /*utf32*/,
On Monday, 15 October 2018 at 18:57:19 UTC, Vinay Sajip wrote:
On Monday, 15 October 2018 at 17:55:34 UTC, Dukc wrote:
This is done automatically for character arrays, which
includes strings. wchar arrays wil iterate by UTF-16, and
dchar arrays by UTF-32. If you have a byte/ubyte array you
On Monday, 8 October 2018 at 21:50:33 UTC, Per Nordlöw wrote:
I'm trying to compile the example
import std.experimental.allocator.building_blocks.free_list
: FreeList;
theAllocator = allocatorObject(FreeList!8());
at https://dlang.org/phobos/std_experimental_allocator.html but
fails
On Monday, 8 October 2018 at 11:19:40 UTC, Per Nordlöw wrote:
I want to understand how calls to `new` for classes
see _d_newclass
and structs are lowered by the compiler and druntime to a
GC-allocation (specifically how the `ba`-argument bits are
determined) followed by an initialization
On Monday, 8 October 2018 at 09:39:55 UTC, John Burton wrote:
My use case is sending data to a socket.
One part of my program generates blocks of bytes, and the
socket part tries to send them to the socket and then removes
from the queue the number that got sent.
[...]
Try searching for
On Saturday, 6 October 2018 at 13:17:22 UTC, bauss wrote:
Let's say you have a range with struct, but some of the struct
are duplicates of each other.
Is there a standard function in Phobos to remove duplicates?
My first thought was "uniq", but it can't really do it like
that, but it doesn't
On Friday, 5 October 2018 at 19:31:56 UTC, Jon Degenhardt wrote:
On Friday, 5 October 2018 at 16:34:32 UTC, Paul Backus wrote:
You can thread multiple arguments through to `each` using
`std.range.zip`:
tenRandomNumbers
.zip(repeat(output))
.each!(unpack!((n, output) =>
On Friday, 5 October 2018 at 06:44:08 UTC, Nicholas Wilson wrote:
Alas is does not because each does not accept additional
argument other than the range. Shouldn't be hard to fix though.
https://issues.dlang.org/show_bug.cgi?id=19287
On Friday, 5 October 2018 at 06:22:57 UTC, Nicholas Wilson wrote:
tenRandomNumbers.each!((n,o) =>
o.appendln(n.to!string))(output);
or
tenRandomNumbers.each!((n, ref o) =>
o.appendln(n.to!string))(output);
should hopefully do the trick (run.dlang.io seems to be down
atm).
Alas is does
On Friday, 5 October 2018 at 03:27:17 UTC, Jon Degenhardt wrote:
I got the compilation error in the subject line when trying to
create a range via std.range.generate. Turns out this was
caused by trying to create a closure for 'generate' where the
closure was accessing a struct containing a
On Tuesday, 2 October 2018 at 01:57:00 UTC, Vladimir Panteleev
wrote:
Ran into this today, don't have time to dig in now but maybe
someone ran into this too.
Steps to reproduce:
- git clone https://github.com/CyberShadow/ae
- cd ae/demo/inputtiming
- (download/unpack
On Sunday, 30 September 2018 at 09:30:38 UTC, Vijay Nayar wrote:
Is there a way to either have a constant reference to a class
that can be set to a new value, or is there a way to convert
the class variable to a class pointer?
Alex has mentioned Rebindable, which is the answer to your first
On Sunday, 30 September 2018 at 07:29:00 UTC, Vijay Nayar wrote:
I have two brief questions.
Code that uses "new" to create struct objects appears to
compile and run. Is this an actual language feature, to get
structs on the heap?
void main()
{
struct S {int data = 1;}
S* s1
On Thursday, 20 September 2018 at 12:43:02 UTC, Nicholas Wilson
wrote:
Hmm, I can reproduce. Will look into it.
pragma(LDC_intrinsic, "llvm.nvvm.cos.approx.f")
float cos(float val);
does work but is an approximation.
On Thursday, 20 September 2018 at 05:16:04 UTC, Sobaya wrote:
On Wednesday, 19 September 2018 at 00:22:44 UTC, Nicholas
Wilson wrote:
On Wednesday, 19 September 2018 at 00:11:13 UTC, Nicholas
Wilson wrote:
On Tuesday, 18 September 2018 at 06:25:33 UTC, Sobaya wrote:
On Tuesday, 18 September
On Wednesday, 19 September 2018 at 00:11:13 UTC, Nicholas Wilson
wrote:
On Tuesday, 18 September 2018 at 06:25:33 UTC, Sobaya wrote:
On Tuesday, 18 September 2018 at 01:39:51 UTC, Nicholas Wilson
wrote:
On Tuesday, 18 September 2018 at 00:25:33 UTC, Sobaya wrote:
I'm waiting for the update.
On Tuesday, 18 September 2018 at 06:25:33 UTC, Sobaya wrote:
On Tuesday, 18 September 2018 at 01:39:51 UTC, Nicholas Wilson
wrote:
On Tuesday, 18 September 2018 at 00:25:33 UTC, Sobaya wrote:
I'm waiting for the update. How's your progress?
I t appears I have broke SPIR-V completely
On Tuesday, 18 September 2018 at 00:25:33 UTC, Sobaya wrote:
I'm waiting for the update. How's your progress?
I t appears I have broke SPIR-V completely somewhere along the
line, I may release a v0.2 with out it, hopefully within the week.
On Tuesday, 18 September 2018 at 00:25:33 UTC, Sobaya wrote:
On Friday, 7 September 2018 at 10:53:25 UTC, Sobaya wrote:
On Friday, 7 September 2018 at 10:17:47 UTC, Nicholas Wilson
wrote:
On Friday, 7 September 2018 at 06:45:32 UTC, Sobaya wrote:
[...]
You're missing an "m" in "nvvm", dunno
On Sunday, 9 September 2018 at 04:53:05 UTC, Nicholas Wilson
wrote:
On Sunday, 9 September 2018 at 04:01:30 UTC, Nicholas Wilson
wrote:
On windows with dub it seems to be creating libfoo.a instead
of foo.lib, I don't think I changed any settings. Old build
based on 2.078 DMDFE seem to have
On Sunday, 9 September 2018 at 04:01:30 UTC, Nicholas Wilson
wrote:
On windows with dub it seems to be creating libfoo.a instead of
foo.lib, I don't think I changed any settings. Old build based
on 2.078 DMDFE seem to have built .lib but LDC based on 2.082
seems to be building .a
This
On windows with dub it seems to be creating libfoo.a instead of
foo.lib, I don't think I changed any settings. Old build based on
2.078 DMDFE seem to have built .lib but LDC based on 2.082 seems
to be building .a
On Friday, 7 September 2018 at 06:45:32 UTC, Sobaya wrote:
Sorry for being late for reply.
I'm using CUDA for back-end.
So you mean if required function is "cos",
pragma(LDC_intrinsic, "llvm.nvv.cos")
T cos(T a);
Is it right?
You're missing an "m" in "nvvm", dunno if that will fix it.
I
On Thursday, 30 August 2018 at 10:34:33 UTC, Sobaya wrote:
On Monday, 27 August 2018 at 12:47:45 UTC, Nicholas Wilson
wrote:
On Monday, 27 August 2018 at 09:57:18 UTC, Sobaya wrote:
On Monday, 27 August 2018 at 09:41:34 UTC, 9il wrote:
On Monday, 27 August 2018 at 08:25:14 UTC, Sobaya wrote:
On Monday, 27 August 2018 at 09:57:18 UTC, Sobaya wrote:
On Monday, 27 August 2018 at 09:41:34 UTC, 9il wrote:
On Monday, 27 August 2018 at 08:25:14 UTC, Sobaya wrote:
I'm using dcompute(https://github.com/libmir/dcompute).
In the development, I have got to use math functions such as
sqrt in
On Sunday, 26 August 2018 at 20:17:30 UTC, aliak wrote:
So if we had this:
struct A(T) {
auto proxy() @trusted {
return B!T();
}
}
struct B(T) {
private A!T* source;
private this(A!T* s) { source = s; }
@disable this();
@disable this(this) {}
@disable void opAssign(B!T);
}
On Monday, 20 August 2018 at 00:27:04 UTC, Nick Sabalausky
(Abscissa) wrote:
Suppose I've wrapped a Variant in a struct/class which ensures
the Variant *only* ever contains types which satisfy a
particular constraint (for example: isInputRange, or hasLength,
etc...).
Is there a way to call a
On Tuesday, 14 August 2018 at 13:16:50 UTC, Nicholas Wilson wrote:
On Tuesday, 14 August 2018 at 13:01:57 UTC, learnfirst1 wrote:
enum string[] a = ["a"];
extern(C) void main() {
int i = 0;
auto s = a[i];
}
---
Error: TypeInfo cannot be used with -betterC
Yes.
On Tuesday, 14 August 2018 at 13:01:57 UTC, learnfirst1 wrote:
enum string[] a = ["a"];
extern(C) void main() {
int i = 0;
auto s = a[i];
}
---
Error: TypeInfo cannot be used with -betterC
Yes. https://issues.dlang.org/show_bug.cgi?id=19169
On Saturday, 11 August 2018 at 23:12:43 UTC, ag0aep6g wrote:
On 08/11/2018 11:20 PM, rikki cattermole wrote:
On 12/08/2018 8:55 AM, Eric wrote:
Code below compiles while I would not expect it to compile.
Is there a reason that this compiles?
[...]
No bug. You forgot to throw -unittest when
On Wednesday, 8 August 2018 at 01:33:26 UTC, Steven Schveighoffer
wrote:
On 8/7/18 9:20 PM, Nicholas Wilson wrote:
the first overload is
ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R
haystack, Rs needles)
if (isForwardRange!R
&& Rs.length > 0
&& isForwardRange!(Rs[0]) ==
On Wednesday, 8 August 2018 at 01:33:26 UTC, Steven Schveighoffer
wrote:
On 8/7/18 9:20 PM, Nicholas Wilson wrote:
the first overload is
ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R
haystack, Rs needles)
if (isForwardRange!R
&& Rs.length > 0
&& isForwardRange!(Rs[0]) ==
the first overload is
ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R haystack,
Rs needles)
if (isForwardRange!R
&& Rs.length > 0
&& isForwardRange!(Rs[0]) == isInputRange!(Rs[0])
&& is(typeof(startsWith!pred(haystack, needles[0])))
&& (Rs.length == 1
||
On Sunday, 5 August 2018 at 10:12:39 UTC, Alex wrote:
On Sunday, 5 August 2018 at 01:15:07 UTC, Nicholas Wilson wrote:
On Saturday, 4 August 2018 at 18:12:05 UTC, Alex wrote:
On Saturday, 4 August 2018 at 13:26:01 UTC, Nicholas Wilson
That is a very long stacks trace and combined with the very
On Saturday, 4 August 2018 at 18:12:05 UTC, Alex wrote:
On Saturday, 4 August 2018 at 13:26:01 UTC, Nicholas Wilson
wrote:
0 ldc2 0x000106fcc4e7
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 ldc2 0x000106fcb9ea
On Saturday, 4 August 2018 at 12:21:36 UTC, Alex wrote:
I'm a little bit confused by following situation:
I have code, say around 8000 lines. Now, I'm facing a build
error which just says
dmd failed with exit code -11,
(same for ldc2, with some lines of stack information, which do
not
On Thursday, 2 August 2018 at 02:13:41 UTC, Hakan Aras wrote:
On Thursday, 2 August 2018 at 01:39:58 UTC, Nicholas Wilson
wrote:
https://issues.dlang.org/show_bug.cgi?id=19134
I wasn't quite sure whether it's a bug since it happens in both
compilers. Thanks for opening the issue.
For
On Wednesday, 1 August 2018 at 20:10:44 UTC, Hakan Aras wrote:
On Wednesday, 1 August 2018 at 16:25:28 UTC, Hakan Aras wrote:
https://run.dlang.io/is/dSVruv
Whoops, that was the wrong one. It's fixed now.
https://issues.dlang.org/show_bug.cgi?id=19134
As a workaround remove static, as
On Tuesday, 31 July 2018 at 14:27:18 UTC, rikki cattermole wrote:
On 01/08/2018 2:18 AM, Nicholas Wilson wrote:
On Tuesday, 31 July 2018 at 13:52:21 UTC, rikki cattermole
wrote:
On 01/08/2018 1:43 AM, Nicholas Wilson wrote:
My application needs to load shared libraries: on Posix this
is only
On Tuesday, 31 July 2018 at 13:52:21 UTC, rikki cattermole wrote:
On 01/08/2018 1:43 AM, Nicholas Wilson wrote:
My application needs to load shared libraries: on Posix this
is only supported with a shared druntime. How does one link to
the dynamic druntime with dub?
The same way you do it
My application needs to load shared libraries: on Posix this is
only supported with a shared druntime. How does one link to the
dynamic druntime with dub?
On Friday, 20 July 2018 at 12:03:20 UTC, evilrat wrote:
On Friday, 20 July 2018 at 04:31:38 UTC, Jordan Wilson wrote:
On Friday, 20 July 2018 at 01:34:39 UTC, Mike Parker wrote:
On Thursday, 19 July 2018 at 21:43:35 UTC, Jordan Wilson
wrote:
Is there any way I can generate the appropriate
On Friday, 20 July 2018 at 05:12:05 UTC, Mike Parker wrote:
On Friday, 20 July 2018 at 04:31:38 UTC, Jordan Wilson wrote:
I don't have MSVC, so I built it using mingw, which generated
a .a lib.
I shall google some more, as I understand it DMD -m64 uses
Mingw libs as a fall back when MSVC not
On Friday, 20 July 2018 at 01:34:39 UTC, Mike Parker wrote:
On Thursday, 19 July 2018 at 21:43:35 UTC, Jordan Wilson wrote:
Is there any way I can generate the appropriate lib?
Else I think I'll need to get hold of the proper import libs
that come with the Lua distribution.
Lua is
I'm trying to create an import library from a dll (in this case,
a Lua dll).
Using dumpbin, I end up with a .def file:
EXPORTS
luaL_addlstring
luaL_addstring
luaL_addvalue
luaL_argerror
luaL_buffinit
...
I then use MS lib tool to generate a lib file:
lib /def:lua53.def /out:lua53.lib
On Wednesday, 18 July 2018 at 11:29:42 UTC, baz@dlang-community
wrote:
On Wednesday, 18 July 2018 at 11:22:36 UTC, Nicholas Wilson
wrote:
On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson
wrote:
[...]
Ahh, the joys of memory corruption.
You've reached
On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote:
...
string key = "blahblahblah";
auto mac = hmac!SHA256(key.representation);
string s = ...,t=...u=...,v=...;
foreach(w;AliasSeq!(s,t,u,v))
mac.put(w.representation);
ubyte[32] s = mac.finish;
string sig =
...
string key = "blahblahblah";
auto mac = hmac!SHA256(key.representation);
string s = ...,t=...u=...,v=...;
foreach(w;AliasSeq!(s,t,u,v))
mac.put(w.representation);
ubyte[32] s = mac.finish;
string sig = toHexString!(LetterCase.lower)(s);
writeln(sig);
// From what I understand
On Wednesday, 4 July 2018 at 14:07:35 UTC, Timoses wrote:
How can I return inferred storage class from interface
functions?
I can't use auto as return value in interface. Neither can I
use "inout" as I don't pass a parameter.
// Ref Type
interface IRef
{
On Thursday, 28 June 2018 at 19:22:38 UTC, Jonathan M Davis wrote:
On Thursday, June 28, 2018 18:10:07 kdevel via
Digitalmars-d-learn wrote:
On Tuesday, 26 June 2018 at 21:54:49 UTC, Jonathan M Davis
wrote:
> [H]onestly, I don't understand why folks keep trying to put
> nullable types in
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
On Sunday, 24 June 2018 at 01:43:41 UTC, ANtlord wrote:
On Sunday, 24 June 2018 at 01:26:48 UTC, ANtlord wrote:
Actually I get it worked replacing `string filepath2` by
`char[] filepath2` but filepath is string still and it works
correctly.
It doesn't work
Vorbis is a C library, so you
On Thursday, 21 June 2018 at 21:00:46 UTC, Michael Brown wrote:
Hi D Community,
Is it possible to get a slice of a function, rather than just
its start pointer?
No.
I'm interested in currying a function at runtime - So I would
need to copy a function block (Either the original function,
On Wednesday, 20 June 2018 at 05:49:15 UTC, Dukc wrote:
On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote:
Is there anything I can do to improve zip, before I go ahead
and change to the faster but slightly less readable enumerate?
The problem might be that zip checks both arrays
Hello,
Idiomatically, I make use of zip, however, when looking to speed
up my program, notice that using enumerate leads to a 20-30%
improvement:
void main(){
auto x = iota(1_000).array;
auto y = iota(1_000).array;
auto func1() {
return zip(x,y).map!(a => a[0]+a[1])
On Sunday, 17 June 2018 at 10:58:29 UTC, Cauterite wrote:
Hello,
I'm not sure whether I'm missing something obvious here, but is
there a reason for scope(success) being lowered to a try-catch
statement?
I would have expected only scope(exit) and scope(failure) to
actually interact with
On Tuesday, 29 May 2018 at 04:49:34 UTC, Nicholas Wilson wrote:
On Tuesday, 29 May 2018 at 01:43:17 UTC, Mike Parker wrote:
In pdf.h, that CAPI macro is used in every function
declaration. That means that on Windows, all of the functions
have the __stdcall calling convention (which, in D,
On Tuesday, 29 May 2018 at 01:43:17 UTC, Mike Parker wrote:
In pdf.h, that CAPI macro is used in every function
declaration. That means that on Windows, all of the functions
have the __stdcall calling convention (which, in D, would be
extern(Windows)) and the standard cdecl calling convetion
On Thursday, 24 May 2018 at 18:51:31 UTC, Mike Franklin wrote:
I'm trying to find a way to declare a block of code `nothrow:`
when compiling with -betterC, but not `nothrow` when not
compiling with -betterC.
[...]
Not one now but, DIP 1012 will allow this as nothrow will become
a regular
On Monday, 28 May 2018 at 01:28:10 UTC, Dr.No wrote:
I'm trying to use wkhtmltopdf[1] with D. I converted this
header[2] with little modification using htod tool which
resulted in this[3].
The libray is passed to link using:
pragma(lib, "wkhtmltox.lib");
(that file is in wkhtmltopdf\lib
On Thursday, 24 May 2018 at 08:16:30 UTC, biocyberman wrote:
Some C and C++ projects I am working on use pointers and
references extensively: to pass as function arguments, and to
return from a function. For function argument I would use
`ref`, but for return types, I can't use `ref` and can't
On Wednesday, 23 May 2018 at 03:12:52 UTC, IntegratedDimensions
wrote:
I knew someone was going to say that and I forgot to say DON'T!
Saying to profile when I clearly said these ARE cases where
they are slow is just moronic. Please don't use default answers
to arguments.
This was a general
On Wednesday, 23 May 2018 at 02:24:08 UTC, IntegratedDimensions
wrote:
Many times in expensive loops one must make decisions.
Decisions must be determined and the determination costs.
for(int i = 0; i < N; i++)
{
if(decision(i)) A; else B;
}
the if statement costs N times the cycle
-
module a;
struct foo {}
deprecated alias bar = foo;
--
module b;
struct bar {};
---
module c;
import a;
import b;
void baz(bar b) {}
Error: `a.bar` at source/a.d(5,1) conflicts with `b.bar` at
.b.d(2,1)
I would have thought the undeprecated alias would have
On Wednesday, 25 April 2018 at 13:52:16 UTC, Steven Schveighoffer
wrote:
[...]
Great, thanks for you help Steve, I'll have a think about how I
want to structure things.
Jordan
On Tuesday, 24 April 2018 at 23:49:14 UTC, Steven Schveighoffer
wrote:
What you are missing is that Database is pass-by-value, not a
class. So when you include it directly in a class like you did
in A, then when A's destructor is called, db's destructor is
called.
Since in the first case, a
I have the following code:
import std.stdio;
import std.typecons;
import d2sqlite3;
class A {
Database db;
this ( Database d) {
db = d;
}
}
class B {
Database* db;
this ( Database* d) {
db = d;
}
}
void main() {
auto db = Database(":memory:");
On Saturday, 21 April 2018 at 23:47:41 UTC, Mike Franklin wrote:
On Saturday, 21 April 2018 at 19:06:52 UTC, Steven
Schveighoffer wrote:
alloca is an intrinsic, and part of the language technically
-- it has to be.
From what I can tell `alloca` is only available in the
platform's C
On Wednesday, 18 April 2018 at 13:15:08 UTC, Guillaume Piolat
wrote:
The D specification says:
"A ConditionalStatement that has a DebugCondition is called a
DebugStatement. DebugStatements have relaxed semantic checks in
that pure, @nogc, nothrow and @safe checks are not done.
Neither do
On Tuesday, 17 April 2018 at 12:42:48 UTC, Dgame wrote:
On Tuesday, 17 April 2018 at 11:01:21 UTC, Nicholas Wilson
wrote:
On Tuesday, 17 April 2018 at 10:17:56 UTC, Dgame wrote:
Ah, I found the msvcEnv.bat and I told me that I have to VSC
installation. Solved!
You should also be able to use
On Tuesday, 17 April 2018 at 10:17:56 UTC, Dgame wrote:
Ah, I found the msvcEnv.bat and I told me that I have to VSC
installation. Solved!
You should also be able to use -link-internally /LLMV's lld if
you don't want to install MSVC
On Thursday, 12 April 2018 at 07:48:28 UTC, Jamie wrote:
On Thursday, 12 April 2018 at 06:30:25 UTC, Tony wrote:
On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote:
Am I using the -I compiler option incorrectly?
I believe so. I think it is for finding import files, not the
files you
On Thursday, 12 April 2018 at 06:22:30 UTC, Nicholas Wilson wrote:
On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote:
Am I using the -I compiler option incorrectly?
is it thinking /../A is an absolute path?
try -I=./../A
Er, scratch that. I see you already tried it.
On Thursday, 12 April 2018 at 05:39:21 UTC, Jamie wrote:
With a directory structure as follows:
run/
A/
a.d
Where a.d is:
===
module A.d;
I'm attempting to compile from the run/ directory. If I run with
dmd ../A/a.d
it compiles successfully, however if I
On Wednesday, 11 April 2018 at 22:13:33 UTC, Sjoerd Nijboer wrote:
On Wednesday, 11 April 2018 at 21:29:27 UTC, Alex wrote:
I would say, alias template parameter is your friend.
https://dlang.org/spec/template.html#TemplateAliasParameter
class SortedList(T, alias comparer)
It works, thank
On Tuesday, 3 April 2018 at 19:02:25 UTC, Vladimirs Nordholm
wrote:
Hello people.
I currently have a function which multiple times per second
takes in arguments, and appends the argument as my special
type. The following code should explain what I do more properly:
struct MySpecialType
On Thursday, 29 March 2018 at 08:47:50 UTC, dangbinghoo wrote:
* #define SPI_MSGSIZE(N) \
N)*(sizeof (struct spi_ioc_transfer))) < (1 <<
_IOC_SIZEBITS)) \
? ((N)*(sizeof (struct spi_ioc_transfer))) : 0)
*/
extern (D) size_t SPI_MSGSIZE(size_t N)
{
return ((N *
On Sunday, 25 March 2018 at 21:26:57 UTC, aliak wrote:
Hi, I have this optional type I'm working on and I've run in to
a little snag when it comes to wrapping an immutable. Basically
what I want is for an Optional!(immutable T) to still be
settable to "some" value or "no" value because the
On Monday, 18 September 2017 at 21:58:39 UTC, Alex wrote:
On Monday, 18 September 2017 at 18:49:54 UTC, ag0aep6g wrote:
Doesn't work for me. This still fails compilation with the
same error:
import std.algorithm.iteration : sum, cumulativeFold;
void main()
{
double[5] a;
auto
On Thursday, 22 March 2018 at 14:05:02 UTC, steven kladitis wrote:
-- what is the difference between int[] x; and int[int] x;
int[] x; is like
struct _Int_Array
{
size_t len;
int* ptr;
}
_Int_Array y;
int i = 5;
x[i] = i; // this and the line below crash or assert, due to a
null
On Thursday, 22 March 2018 at 10:08:31 UTC, Nordlöw wrote:
Is there a way to check in code whether a specific flag,
-dip1000 in my case, was passed to the compiler?
Most command line arguments that are detectable set a version,
e.g. D_Coverage, unittest, assert,D_BetterC. I don't see dip1000
On Thursday, 22 March 2018 at 03:58:35 UTC, Seb wrote:
On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote:
auto a = iota(5).slide!(Yes.withPartial)(3);
auto b = iota(5).slide!(No.withPartial)(3);
assert (a.equal(b));
The assert passes, but I would expect it to fail? They both
auto a = iota(5).slide!(Yes.withPartial)(3);
auto b = iota(5).slide!(No.withPartial)(3);
assert (a.equal(b));
The assert passes, but I would expect it to fail? They both are:
[[0,1,2],[1,2,3],[2,3,4]]
Thanks,
Jordan
On Monday, 12 March 2018 at 22:24:15 UTC, Xavier Bigand wrote:
mixin(implementFunctionsOf("derelict.opengl3.functions"));
As string I get the following error:
..\src\api_entry.d(16): Error: variable `mod` cannot be read at
compile time
..\src\api_entry.d(48):called from here:
101 - 200 of 697 matches
Mail list logo