On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote:
Why using 'new' is allowed in pure functions but calling
GC.addRange or GC.removeRange isn't allowed?
pure is broken. Just don't [use it]
On Sunday, 5 January 2020 at 22:39:37 UTC, Teo wrote:
On Sunday, 5 January 2020 at 13:37:58 UTC, JN wrote:
[...]
Thanks for the input.
I just realized that I was not precise enough in my
description. Apologies for that.
My intention is to use std.algorithm, if possible.
I read the documenta
Lol, you don't have to load and unload the curl dll.
std.net.curl have its own lazy libcurl loader. But i'm not sure
if it tries to find the dll in the temp directory. If it is the
case, then it simply doesn't unload the dll when you have called
some function from it.
On Tuesday, 6 February 2018 at 08:29:05 UTC, Kagamin wrote:
On Monday, 5 February 2018 at 15:33:02 UTC, Steven
Schveighoffer wrote:
Is there a more pragmatic use case why this should be possible?
Maybe for least surprise. The error message almost convinced me
that such cast is impossible, onl
On Monday, 25 December 2017 at 14:37:01 UTC, Mengu wrote:
On Monday, 25 December 2017 at 14:12:32 UTC, Marc wrote:
Does to!(string)(char[]) do any memory allocation on
conversion or is this similar to a cast or what else?
yes, it is allocating memory. you can test such cases with
@nogc [0].
On Monday, 25 December 2017 at 14:12:32 UTC, Marc wrote:
Does to!(string)(char[]) do any memory allocation on conversion
or is this similar to a cast or what else?
It is translated to idup.
So yes, it allocates memory.
On Wednesday, 20 December 2017 at 13:41:06 UTC, Vino wrote:
On Tuesday, 19 December 2017 at 18:42:01 UTC, Ali Çehreli wrote:
On 12/19/2017 02:24 AM, Vino wrote:
> Hi All,
>
>Request your help in clarifying the below. As per the
document
>
> foreach (d; taskPool.parallel(xxx)) : The total num
On Tuesday, 28 November 2017 at 06:46:18 UTC, Dmitry wrote:
On Monday, 27 November 2017 at 19:01:28 UTC, Ali Çehreli wrote:
P.S. I think you have an unnecessary 'ref' on the D version
because a slice is already a reference to elements:
Fixed, thank you.
https://pastebin.com/xJXPBh0n
Converted
On Thursday, 23 November 2017 at 14:16:25 UTC, Andrea Fontana
wrote:
On Thursday, 23 November 2017 at 13:47:37 UTC, Adam D. Ruppe
wrote:
On Thursday, 23 November 2017 at 05:19:27 UTC, Andrey wrote:
for instance in kotlin it can be replace with this:
when {
c1 -> foo(),
c2 -> bar(),
On Monday, 13 November 2017 at 10:20:51 UTC, Aurelien Fredouelle
wrote:
Hi all,
It seems that it is not possible to use minElement on an array
of const objects:
class A
{
int val;
}
const(A) doStuff(const(A)[] v)
{
import std.algorithm.searching : minElement;
return v.minElement!"a.val
On Friday, 13 October 2017 at 11:21:48 UTC, Biotronic wrote:
On Friday, 13 October 2017 at 10:35:56 UTC, Jack Applegame
wrote:
Compiler creates struct on the stack and silently (without
postblitting and destruction old object) moves it to another
address. Is it normal? I don't think so.
It is
Sorry, messed up numbers
Expected:
3.11
3.11
3.1
3.1
Seems g outputs one digit less
import std.stdio;
void main()
{
writefln(`%.2g`, 3.11);
writefln(`%.2f`, 3.11);
writefln(`%.1g`, 3.11);
writefln(`%.1f`, 3.11);
}
3.1
3.11
3
3.1
But expected
3.1
3.11
3.1
3.11
On Saturday, 5 August 2017 at 19:19:06 UTC, Simon Bürger wrote:
On Saturday, 5 August 2017 at 18:54:22 UTC, ikod wrote:
Maybe std.functional.partial can help you.
Nope.
int i = 1;
alias dg = partial!(writeln, i);
i = 2;
dg();
still prints '2' as it should beca
On Saturday, 5 August 2017 at 15:42:53 UTC, Rene Zwanenburg wrote:
On Saturday, 5 August 2017 at 15:33:57 UTC, Matthew Remmel
wrote:
Any ideas?
You can use to! in std.conv:
import std.stdio;
import std.conv;
enum Foo
{
A = "A",
B = "B"
}
void main()
{
writeln("A".to
On Thursday, 3 August 2017 at 14:03:56 UTC, Michael wrote:
So this might be a bit of a stupid question, but looking at the
DMD source code (dmodule.d in particular) I see the following
code:
if (srcfile._ref == 0)
.free(srcfile.buffer);
srcfile.buffer = null;
srcfile.len = 0;
and I was j
On Sunday, 30 July 2017 at 08:18:07 UTC, Danni Coy wrote:
The following code is not working for me
float[3] f;
f[] = abs(f)[] * -1.0f;
where abs is a function that returns a float[3];
it complains that f should be attached to some memory.
Is it a bug or am I missing something?
This is unimpl
On Friday, 28 July 2017 at 08:06:33 UTC, Eugene Wissner wrote:
On Friday, 28 July 2017 at 06:32:59 UTC, Jacob Carlborg wrote:
On 2017-07-27 16:30, Eugene Wissner wrote:
I have a multi-threaded application, whose threads normally
run forever. But I need to profile this program, so I compile
the
Also there was an issue that profiling doesn't work with
multi-threaded apps and leads to a crash.
Don't know if it is fixed.
Exit is not "normal exit" for D programs so, do not use it.
Your threads should stop at some point to make able the app exit
successfully.
There's a "join" method. You can use it with your "done" variable.
On Wednesday, 26 July 2017 at 19:06:24 UTC, Andre Pany wrote:
On Wednesday, 26 July 2017 at 17:04:59 UTC, Adam D. Ruppe wrote:
On Wednesday, 26 July 2017 at 16:50:35 UTC, Andre Pany wrote:
[...]
FYI, you shouldn't use .stringof here. Just use `T` instead of
`T.stringof`.
[...]
Thank you
Hi !
I have a dub package that doing this.
https://github.com/Temtaime/tt-utils/blob/master/source/tt/binary/tests.d
Have a look at the tests.
Currently it has no documentation, but feel free to ask questions
On Sunday, 16 April 2017 at 15:54:16 UTC, Stefan Koch wrote:
On Sunday, 16 April 2017 at 10:56:37 UTC, Era Scarecrow wrote:
On Saturday, 15 April 2017 at 11:10:01 UTC, Stefan Koch wrote:
It would requires an O(n^2) check per declaration.
Even it is never used.
which would make imports that much
On Monday, 31 October 2016 at 16:55:51 UTC, WhatMeWorry wrote:
Is there a way to turn off nothrow or work around it? Because
to me it looks like nothrow prevents me from doing anything
useful.
extern(C) void onKeyEvent(GLFWwindow* window, int key, int
scancode, int action, int modifier) not
On Friday, 28 October 2016 at 18:39:36 UTC, Ali Çehreli wrote:
On 10/28/2016 11:25 AM, Jonathan M Davis via
Digitalmars-d-learn wrote:
>> void main() {
>> @(`str`, 123) uint k;
>> foreach (a; __traits(getAttributes, k)) {
>> pragma(msg, typeof(a));
>> }
>> }
> I don't k
On Friday, 28 October 2016 at 12:44:20 UTC, Adam D. Ruppe wrote:
On Friday, 28 October 2016 at 10:52:05 UTC, Temtaime wrote:
Are there something or should I create a PR to phobos?
Why would you want that?
I have UDAs with values à la @(`str`, 123) uint k;
And i want to know a type of a valu
Hi !
Tried to find
alias Typeof(alias A) = typeof(A);
or something, but failed.
Are there something or should I create a PR to phobos?
Thanks
Hi !
I can't find this in specs.
If i add an element to AA:
aa[10] = 123;
Will &aa[10] be always the same (of course i don't remove that
key) ?
Thanks for a reply.
I think specs should be enhanced.
Hi !
I wonder if i can rely on this code :
http://dpaste.dzfl.pl/745cc5b1cdfb
There's two questions:
1) Is dtors always called in reverse order ?
2) Is all the dtors always called when i call destroy ?
Thanks for a reply !
Offtop: i think if number of threads > number of real cores, than
there's something wrong with your design. Maybe fibers suit
better ?
There's a problem with « dst[0 .. n] = val; ».
It should be « dst[0 .. n][] = val; »
It's because it's implemented in DMD only partly.
There's a bug report associated with it.
I'm writing a game engine in D. Try to minimize allocations and
that's will be OK.
I'm using delegates and all the phobos stuff. I allocate only in
few places at every frame.
So i can reach 1K fps on a complicated scene.
GC is not a problem. DMD optimizes so ugly that all the math is
very, ver
All types are hashable and for your own structs and classes you
can redefine opHash
Sorry, i meant it gives b == "fooo\\nbar"
I'm writing an interpreter and it should dump original string
from memory.
Also i wonder if there's a function to convert "aaa\\nbb" to
"aaa\nbb" (i.e. to unescape)
Hi ! I wonder how to escape a string in phobos ?
For example
auto a = [ "fooo\nbar" ];
auto b = format("%(%s%)", a);
gives b: "fooo\nbar"
Is there any other function to escape string? I'm looking for
something that doesn't require to make an array at first.
For example is there string escape
Setting up LLVM infrastructure is only needed when you is a LDC
developer.
I think for ordinary users it's not their business.
It's only words.
If we speak about LDC it can compile fast in debug mode with
performance average to DMD's backend but with much great
performance in release mode thanks to vectorization and other
techniques.
Also LDC thanks to LLVM supports X86, X86-64, PowerPC,
PowerPC-64, ARM, Thumb, SPARC,
align doesn't work in DMD. There's bugreport for a long time.
DWORD is an uint.
Offtop
It's better to return "this" and have return type "ref auto" i
think.
Also second question is what are better to use, current template
recursion-based code or rewrite it to CTFE ?
Hi !
http://dpaste.dzfl.pl/e21082716396
Is there a way to optimize
static if(is(typeof(__traits(getMember, T, name).offsetof)) ==
false && is(FunctionTypeOf!(__traits(getMember, T, name)) ==
function) == false && __traits(compiles, &__traits(getMember, T,
name)))
?
I think there shoult be
Hi ! Thanks for reply.
Why so ?
And why @nogc not transitive too ?
Hi, MrSmith !
Yes, i know that, but my question isn't about it.
I want to type `pure:` at module's beginning and have all
function(in classes, too) declared as pure.
I think `pure:` should do it. But it doesn't.
Hi !
http://dpaste.dzfl.pl/2fa3dd2ea834
Why S.init not pure ? Is it expected behavior or bug ?
Thanks!
46 matches
Mail list logo