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.
Is it a good idea to std.concurrency.spawn a new thread?..
This example code shows my situation:
MmFile input = new MmFile(/* ... */);
ulong fileSize
On Tuesday, 30 June 2020 at 20:04:33 UTC, Steven Schveighoffer
wrote:
The answer is -- update Phobos so it works with -nosharedaccess
:)
Yeah... and dip1000. And dip1008. And dip... :)
On Tuesday, 30 June 2020 at 19:58:05 UTC, matheus wrote:
+loc.linnum = loc.linnum + incrementLoc;
This works because it was declared:
void linnum(uint rhs) { _linnum = rhs; }
Right?
Almost. Given these definitions:
@safe @nogc pure @property
{
const uint linnum() { return
On Tuesday, 30 June 2020 at 19:42:57 UTC, matheus wrote:
in this case this was more a style thing than anything else
right? Or is there something I'm not able to see?
Before the change, linnum and charnum are public variables, one
can do a += on them. After the change, they become properties
On Monday, 29 June 2020 at 22:31:12 UTC, Arjan wrote:
So when no inner scope is present, the scope exit 'runs' after
the return? Is that indeed expected behavior according to the
specification?
Yes. A scope ends at the '}'. Destructors and scope guards
execute then, after the return.
On Monday, 29 June 2020 at 06:21:43 UTC, ag0aep6g wrote:
Since `local` and `writeln` are templates, the attributes for
their parameters are inferred from their bodies. `local!(int*)`
doesn't do anything with the parameter, so it's inferred as
`scope`. `writeln!(int*)` apparently does
On Monday, 29 June 2020 at 02:11:15 UTC, NonNull wrote:
Deprecation: Cannot use alias this to partially initialize
variable j of type refer. Use j._()
This is for the line j=3
What is this about? Where does this hidden rule come from?
That one comes from [1]. But there are quite a few more
void local(Args...)(Args args)
{
}
void main() @safe
{
import std.stdio;
scope int* p;
local(p); // Ok
writeln(p); // Error: scope variable p assigned to non-scope
parameter _param_0 calling std.stdio.writeln!(int*).writeln
}
The signatures of `std.stdio.writeln` and `local`
On Sunday, 28 June 2020 at 23:02:26 UTC, aberba wrote:
I believe this:
StopWatch sw;
sw.start;
works becuse D structs are initialized by default, right?
I've never actually done it this way. Little details.
Yup. You can also do a
auto sw = StopWatch(AutoStart.yes);
and not have to call
On Sunday, 28 June 2020 at 13:29:08 UTC, aberba wrote:
Getting error:
Error: template std.concurrency.spawn cannot deduce function
from argument types !()(void delegate(Tid id) @system, Tid),
candidates are:
/usr/include/dmd/phobos/std/concurrency.d(460,5):
spawn(F, T...)(F fn, T
On Saturday, 27 June 2020 at 16:03:12 UTC, kinke wrote:
On Saturday, 27 June 2020 at 15:27:34 UTC, Stanislav Blinov
wrote:
Hrm... What happens if you call collect() twice?
Nothing changes, even when collecting 5 times at the end of
each iteration. In the filed testcase, I've extracted
On Saturday, 27 June 2020 at 14:12:09 UTC, kinke wrote:
Note that I explicitly clear the `str` slice before
GC.collect(), so that the stack shouldn't contain any refs to
the fat string anymore.
Hrm... What happens if you call collect() twice?
On Saturday, 27 June 2020 at 11:35:12 UTC, Arafel wrote:
If you are using linux, have in mind that the memory is often
not returned to the OS even after a (libc) free.
That's a good observation. Although a GC implementation is not
required to actually use malloc, so depending on that falls
On Saturday, 27 June 2020 at 11:11:38 UTC, James Gray wrote:
I am measuring the memory usage using top from the command line.
GC.minimize() does seem to stop the leak.
That is not a memory leak. That's the allocator keeping pages for
itself to not have to go to the kernel every time you
On Saturday, 27 June 2020 at 10:08:15 UTC, James Gray wrote:
I find that the memory usage grows to about 1.5GB and never
decreases. Is there something I am not understanding?
How are you measuring that? GC.collect() does not necessarily
release the pages to the OS. For that, there's the
On Tuesday, 23 June 2020 at 05:24:37 UTC, H. S. Teoh wrote:
On Tue, Jun 23, 2020 at 03:25:55AM +, Stanislav Blinov via
Digitalmars-d-learn wrote:
On Tuesday, 23 June 2020 at 02:41:55 UTC, Jonathan M Davis
wrote:
> We'd need some major redesigning to make uncopyable ranges
>
On Tuesday, 23 June 2020 at 03:52:23 UTC, Jonathan M Davis wrote:
On Monday, June 22, 2020 9:25:55 PM MDT Stanislav Blinov via
Digitalmars-d- learn wrote:
On Tuesday, 23 June 2020 at 02:41:55 UTC, Jonathan M Davis
wrote:
> As things stand, uncopyable ranges aren't really a thing,
> and
On Tuesday, 23 June 2020 at 02:41:55 UTC, Jonathan M Davis wrote:
As things stand, uncopyable ranges aren't really a thing, and
common range idiomns rely on ranges being copyable.
Which idioms are those? I mean, genuine idioms, not design flaws
like e.g. references.
We'd need some major
On Monday, 22 June 2020 at 21:33:08 UTC, H. S. Teoh wrote:
Don't be shocked when you find out how many Phobos ranges have
.init states that are invalid (e.g., non-empty, but .front and
.popFront will crash / return invalid values).
Which ones?
Jonathan is coming from the POV of generic
On Monday, 22 June 2020 at 21:46:57 UTC, Per Nordlöw wrote:
Has anybody written a procedure for creating a temporary file
in a race-free manner?
And why has such a procedure not already been added to std.file
when std.file.tempDir has?
See: https://dlang.org/library/std/file/temp_dir.html
On Monday, 22 June 2020 at 20:51:37 UTC, Jonathan M Davis wrote:
You're unlikely to find much range-based code that does that
and there really isn't much point in doing that. Again, copying
isn't the problem. It's using the original after making the
copy that's the problem.
Copy *is* the
On Monday, 22 June 2020 at 19:55:29 UTC, mw wrote:
Yes, in the same order and of the same length.
Can we add this information to the doc? to make it clear to the
user:
https://dlang.org/library/std/traits.html
It's pretty clear in that doc already:
alias FieldNameTuple(T) =
On Saturday, 20 June 2020 at 21:11:57 UTC, tastyminerals wrote:
I am not sure that this is a question about D or a more general
one. I have watched this nice presentation "Speed Is Found In
The Minds of People" by Andrei:
https://www.youtube.com/watch?v=FJJTYQYB1JQ=youtu.be?t=2596 and on 43:20
On Saturday, 20 June 2020 at 20:17:54 UTC, mw wrote:
Are their returned value, i.e the field names and their types
are always in the same order, and of the same length?
If they are not, how to get sync-ed pairs (name, type)?
If they are, why we need two separate calls, which cause
confusion.
On Thursday, 18 June 2020 at 17:39:44 UTC, Denis wrote:
I should add that this one made me laugh though, giving
flashbacks to that horrible "not speak" of the early 90s:
if ( configfile.isFile.not ) ...
LOL
Approve Yoda does.
On Thursday, 18 June 2020 at 13:57:39 UTC, Dukc wrote:
No reason to use templates here
Pff. Me no think straight. -.-
On Thursday, 18 June 2020 at 12:13:21 UTC, Denis wrote:
THE ESSENTIAL QUESTION
Is there a way to write an `unless` operator that would allow
the condition to be expressed in an affirmative sense? It would
be used like `if`, i.e. something like:
unless ( ) {
; // Or even:
On Wednesday, 17 June 2020 at 23:46:54 UTC, Denis wrote:
`if` is not a good substitute, because it works in the opposite
sense, often requiring lots of `not`s. As a trivial example:
assert( configfile.isFile && configfile.extension == ".conf" )
-vs-
if ( !configfile.isFile ||
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
On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote:
Tardy lets users have their cake and eat it too by not making
them have to use classes for runtime polymorphism.
I've got to ask though. Why "tardy"? Search engines be damned? :)
On Sunday, 14 June 2020 at 04:36:09 UTC, Denis wrote:
Note also that the defaults for id and value are fine...
I would welcome a suggestion for how to initialize the keys of
parameters. As there will be a couple dozen of the param string
keys, a more succinct method would be preferable over
On Saturday, 13 June 2020 at 13:08:29 UTC, realhet wrote:
How can be a string represented with 'null' by default instead
on `""`. Unless I state it explicitly with name="" ? o.O
Because string is simply `alias string = immutable(char)[]`, and
default initializer for arrays is null.
On Saturday, 13 June 2020 at 11:26:58 UTC, Johannes Loher wrote:
Why is it a compile error to set `_a` directly but calling `a`
just works fine?
If we prevent modifying members of rvalues directly, I would
also expect calling non-const member functions of rvalues to be
prevented.
1)
On Saturday, 13 June 2020 at 09:13:36 UTC, Arafel wrote:
If, however, you're wrapping a function template, however, you
won't know until you actually instantiate it, which is
basically going back to Paul Backus' solution. So the compiler
doesn't always have all the information :)
Well, the
On Friday, 12 June 2020 at 17:50:43 UTC, Arafel wrote:
All in all, I still think something like
`__traits(isRef,return)` would still be worth adding! After all
the compiler already has all the information, so it's just
about exposing it. I'm trying to think of a library solution,
but I find
On Tuesday, 9 June 2020 at 17:40:10 UTC, Basile B. wrote:
Any idea ?
As I replied in the issue report:
Instead of
static if (!is(mixin(member) == module) && !(is(mixin(member
use
static if (is(typeof(mixin(member
On Monday, 8 June 2020 at 18:08:57 UTC, mw wrote:
2) even it does so, but why such simple function as lroundl
cannot be CTFE-ed?
Because, as the error message states, there's no source for it :)
std.math calls into C math library.
On Monday, 8 June 2020 at 00:31:10 UTC, Steven Schveighoffer
wrote:
This is a bug, please file. What is likely happening is that
the template is not moving the data to the underlying C call.
-Steve
That is not a bug, it's a shortcoming of garbage-collected
arrays. D arrays are not
On Sunday, 7 June 2020 at 23:09:41 UTC, Jack Applegame wrote:
auto const_ua = Unique!(const NonCopyable)(move(ca)); //
error, why???
}
```
Moving *from* a const would violate const. At least, until such
time that the compiler is finally taught about move() (hopefully,
sometime this
On Saturday, 6 June 2020 at 12:54:38 UTC, Stanislav Blinov wrote:
The moveEmpalce should compile...
But not when the *first* argument is const though, like in the
example. For *that*, one would have to insert an additional cast.
On Saturday, 6 June 2020 at 11:58:06 UTC, Basile B. wrote:
On Saturday, 6 June 2020 at 08:55:20 UTC, Jack Applegame wrote:
Should it compile?
I think, it should.
maybe it shouldn't but then with another message, for example
Error, cannot `void` initialize a `const` declaration.
since
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
I did it that way:
private enum fieldMap = [ // simple names for descriptive and
structured fields
"hauteur" : "general.height",
"rayon" : "profile.radius",
"plage" : "profile.plage",
"offsetv"
On Sunday, 16 December 2018 at 04:02:57 UTC, Q. Schroll wrote:
On Thursday, 13 December 2018 at 23:33:39 UTC, Stanislav Blinov
wrote:
On Thursday, 13 December 2018 at 13:17:05 UTC, aliak wrote:
Ah. Is there any case where you would not want to do that
when you have a T value as parameter
On Thursday, 13 December 2018 at 13:17:05 UTC, aliak wrote:
Ah. Is there any case where you would not want to do that when
you have a T value as parameter?
Hypothetically, yes, e.g. an object that contains references to
itself. However, D operates on the assumption that you don't have
such
On Sunday, 9 December 2018 at 03:29:27 UTC, Andrew Pennebaker
wrote:
Er, when I try to use either foo.stringof, or
__trait(identifier, foo), I always get that binding name,
rather than the original function name, sad panda.
I can only print out the current variable name, but I want to
On Tuesday, 4 December 2018 at 23:28:42 UTC, H. S. Teoh wrote:
Well OK, for int[] it's kinda silly 'cos that's the default,
but in my code I've often had to write things like:
auto z = cast(float[]) [ 1.0, 2.0, 3.0 ];
Err,
auto z = [ 1.0f, 2, 3 ];
?
On Sunday, 25 November 2018 at 21:38:43 UTC, H. S. Teoh wrote:
Actually, I just thought of a way to do this with the existing
language: use a struct to simulate an enum:
struct E {
alias Basetype = int;
Basetype impl;
alias impl this;
On Sunday, 25 November 2018 at 21:22:09 UTC, sclytrack wrote:
Did DIP1000 go through any review process? I'm seeing it is a
draft.
Review links are at the very end.
https://github.com/dlang/DIPs/blob/master/PROCEDURE.md
Keeps talking about a Drafts subdirectory. I don't see any
directory
On Sunday, 25 November 2018 at 21:23:31 UTC, Vladimirs Nordholm
wrote:
Is there a proper way to convert a string with multibyte
characters into a dstring?
void main() {
import std.conv : to;
import std.stdio : writeln;
string a = "abc123";
auto b = to!dstring(a);
On Sunday, 25 November 2018 at 19:22:36 UTC, sclytrack wrote:
There are 4 rules listed.
...
What is rule 5?
...
Wouldn't you call it D3 because of the name mangling of DIP1000
once activated by default?
That "rule 5" looks like a straight up mistake. As for D3...
IMHO, no, not by a long
On Sunday, 25 November 2018 at 07:19:50 UTC, Stanislav Blinov
wrote:
Granted, it may require some special syntax, i.e.
enum E {
a,
b if version(Windows),
c if version(Windows),
d if version(Posix),
}
or something to that effect.
Come to think of it, since UDAs are now
On Sunday, 25 November 2018 at 05:41:56 UTC, H. S. Teoh wrote:
On Sat, Nov 24, 2018 at 05:48:16PM +, Stanislav Blinov via
Digitalmars-d-learn wrote:
Yup. UDAs did get in there eventually, and version should too.
I think this would be a trivial DIP, by making it such that a
version
On Saturday, 24 November 2018 at 17:43:35 UTC, Jonathan M Davis
wrote:
On Saturday, November 24, 2018 9:28:47 AM MST Stanislav Blinov
via Digitalmars-d-learn wrote:
On Saturday, 24 November 2018 at 07:00:31 UTC, Jonathan M Davis
wrote:
> [not legal]
>
> enum Foo
> {
>
&
On Saturday, 24 November 2018 at 07:00:31 UTC, Jonathan M Davis
wrote:
[not legal]
enum Foo
{
a,
b,
version(linux) c = 42,
else version(Windows) c = 54,
}
You're forced to version the entire enum.
Not in this case, no:
enum Foo
{
a,
b,
c = {
On Saturday, 24 November 2018 at 03:48:12 UTC, Eko Wahyudin wrote:
Hi all,
anyone know how to iterate getSymbolsByUDA ?
enum Attr;
struct A
{
@Attr int a;
int b;
@Attr void foo() {}
@Attr void foo(int) {}
}
void main() {
import std.traits;
import std.stdio;
alias
On Thursday, 22 November 2018 at 09:03:19 UTC, Gary Willoughby
wrote:
On Monday, 19 November 2018 at 06:46:55 UTC, dangbinghoo wrote:
So, can you experts give a more comprehensive compare with
perl6 and D?
Sure!
1). You can actually read and understand D code.
Made my day. Thank you :)
On Tuesday, 20 November 2018 at 13:28:21 UTC, Boris-Barboris
wrote:
On Tuesday, 20 November 2018 at 13:20:08 UTC, Stanislav Blinov
wrote:
https://dlang.org/changelog/2.083.0.html#reboot14246
Nvm, found the info in the issue tracker, thank you for the
link.
You're welcome. It's one of those
On Tuesday, 20 November 2018 at 13:01:40 UTC, Boris-Barboris
wrote:
https://run.dlang.io/is/LdylJX
Notice no "B destructor" line in stdout.
Just got bitten by the assumption that my Buffer struct that
transactionally aquires multiple external resources in
constructor will rollback via member
On Tuesday, 20 November 2018 at 11:54:59 UTC, welkam wrote:
On Monday, 19 November 2018 at 22:14:25 UTC, Neia Neutuladh
wrote:
Nothing stops you from writing:
SomeStruct myStruct;
fd.rawRead((cast(ubyte*))[0..SomeStruct.sizeof]);
Standard caveats about byte order and alignment.
On Monday, 19 November 2018 at 14:51:14 UTC, Steven Schveighoffer
wrote:
Or just use inout. This is literally what inout is for:
inout(q32) toQ32 inout {
return q32(x);
}
This should transfer whatever constancy of the original is used
for the return value.
Yep, I just wanted to
On Monday, 19 November 2018 at 14:04:29 UTC, Dennis wrote:
On Monday, 19 November 2018 at 13:34:50 UTC, Stanislav Blinov
wrote:
Because it's not mutation, it's initialization.
Oh. That's an epiphany for me.
:)
When a ctor is `pure`, the compiler knows it doesn't mutate
any state other
On Monday, 19 November 2018 at 12:28:43 UTC, Dennis wrote:
On Monday, 19 November 2018 at 02:39:32 UTC, Stanislav Blinov
wrote:
You're skimming the examples ;)
I'm not saying your examples don't work, I'm trying to
understand the minimum requirements. You said:
"That's [constru
On Monday, 19 November 2018 at 02:08:14 UTC, Dennis wrote:
On Monday, 19 November 2018 at 01:24:02 UTC, Stanislav Blinov
wrote:
Yup, that's because, like Rubn said, copying value types is
trivial. Where it all comes to bite you is when you start
having pointers, because you can't copy a const
On Monday, 19 November 2018 at 02:03:18 UTC, Dennis wrote:
On Monday, 19 November 2018 at 01:13:29 UTC, Stanislav Blinov
wrote:
You just dismissed that second to last sentence, did you? :)
I don't know what you mean with it. It's not that I'm trying to
be sneaky or lazy really trying
On Monday, 19 November 2018 at 00:50:28 UTC, Dennis wrote:
I'm also trying to make it work with immutable, and from BigInt
[2] I learned that constructors need to be `pure` for creating
immutable objects. (I don't know why.)
That's only for types with indirections (pointers), since `pure`
On Sunday, 18 November 2018 at 20:10:52 UTC, Dennis wrote:
On Sunday, 18 November 2018 at 18:17:54 UTC, Stanislav Blinov
wrote:
Q log2(Q)(inout Q num) if (is(Q : q16) || is(Q : q32)) { /*
... */ }
Being able to jam mutable/const/immutable implementation in
one function like that should
On Sunday, 18 November 2018 at 17:30:18 UTC, Dennis wrote:
I'm making a fixed point numeric type and want it to work
correctly with const. First problem:
```
const q16 a = 6;
a /= 2; // compiles! despite `a` being const.
Ouch. That's actually kind of nasty.
writeln(a); //
Reported:
https://issues.dlang.org/show_bug.cgi?id=19410
On Sunday, 18 November 2018 at 09:10:57 UTC, bauss wrote:
On Sunday, 18 November 2018 at 02:37:13 UTC, Stanislav Blinov
wrote:
It's only "hidden" in that there's no symbol to access it...
But in that case shouldn't you be able to tell whether it has
it or not through hasMem
On Sunday, 18 November 2018 at 00:51:51 UTC, drug wrote:
On 18.11.2018 1:26, Adam D. Ruppe wrote:
That's because the compiler passes it a hidden pointer to
refer to the context outside. The compiler could perhaps be
smarter about it, and see if those methods actually refer to
the context,
On Saturday, 17 November 2018 at 13:55:24 UTC, aliak wrote:
You can use "debug blah" to hide inside functions that are
attributed, but when you have an attributed function that calls
a template, attribtues of which are supposed to be inferred, it
seems to fail.
Maybe a bug if it's supposed
On Saturday, 17 November 2018 at 13:13:36 UTC, aliak wrote:
Sawweet! Thanks, that made the printing possible!
You're welcome ;) Still, try a more recent compiler. This works
fine:
void foo() @nogc {
debug {
import std.stdio;
writefln("%d", 42);
}
}
"scope" is const
On Friday, 16 November 2018 at 12:59:22 UTC, aliak wrote:
Adding @trusted to declaration of opDispatch gets rid of @safe
error but I still get "Error: @nogc function D main cannot call
non-@nogc function". And going through the codebase and
figuring out where to add @trusted is *very*
On Friday, 16 November 2018 at 11:24:20 UTC, Per Nordlöw wrote:
/** Sort sub-range [sub_begin, sub_end] of [begin, end].
*
* Describe at
https://www.youtube.com/watch?v=0WlJEz2wb8Y=2686s
*/
template// I models RandomAccessIterator
void sort_subrange(I begin, I end,
On Tuesday, 13 November 2018 at 07:10:26 UTC, Jamie wrote:
Is this possible? I can't get it to work in the way I'm showing
above.
...or abstract away Ali's solution:
enum OPTION {
FALSE,
TRUE,
}
template Select(OPTION opt, IfTrue, IfFalse) {
static if (opt == OPTION.TRUE) alias
On Saturday, 10 November 2018 at 06:56:29 UTC, Neia Neutuladh
wrote:
The following code doesn't work with @safe -dip1000:
int* p;
int i;
p =
i has a shorter lifetime than p, the compiler complains.
But this code does:
int i;
int* p;
p =
The compiler does this even
On Thursday, 8 November 2018 at 18:48:05 UTC, Neia Neutuladh
wrote:
On Thu, 08 Nov 2018 18:38:55 +, welkam wrote:
On Thursday, 8 November 2018 at 18:15:55 UTC, Stanislav Blinov
wrote:
One keystroke (well ok, two keys because it's *) ;)
https://dl.dropbox.com/s/mifou0ervwspx5i/vimhl.png
On Thursday, 8 November 2018 at 17:50:20 UTC, welkam wrote:
On Wednesday, 7 November 2018 at 22:08:36 UTC, H. S. Teoh wrote:
Now for all of you who think that one letter variables are ok
here is exercise. Go and open src/dmd/func.d with your favorite
code editor. Find function
On Thursday, 8 November 2018 at 16:13:55 UTC, Mike Parker wrote:
On Thursday, 8 November 2018 at 15:50:38 UTC, helxi wrote:
Although it's pretty frustrating, isn't it? Now not only I
have to think about catching exceptions but also about Errors,
and have no guarantee that I have everything
On Wednesday, 7 November 2018 at 20:03:47 UTC, Michelle Long
wrote:
Case A:
int x;
{
if (true) goto X;
//int x;
}
~x;
X:
That is not "Case A". This one is:
{
if (true) goto X;
T x;
X:
} // x.__dtor
That should error as an easy cop-out, nothing wrong with that
approach.
On Tuesday, 6 November 2018 at 21:19:29 UTC, Peter Campbell wrote:
Given your second example that makes me think that, because
object functions are provided by the runtime without me
explicitly importing it, this is likely only an issue for
object functions? Or can this behaviour happen with
Sorry, forgot to put the spec link into my previous resonse:
https://dlang.org/spec/function.html#overload-sets
On Tuesday, 6 November 2018 at 20:40:11 UTC, Peter Campbell wrote:
Hi there. I've been playing with D and have encountered this
really awkward behaviour. Basically I'm getting a compiler
error inside a function I wrote in my module as it thinks I'm
trying to call itself with invalid
On Tuesday, 6 November 2018 at 00:38:01 UTC, MatheusBN wrote:
On Tuesday, 6 November 2018 at 00:13:52 UTC, Stanislav Blinov
wrote:
But here it's fine:
void main(){
{
goto Q;
S x;
} // <---
Q:
writeln("a");
}
because goto jumps over both i
On Monday, 5 November 2018 at 23:54:59 UTC, MatheusBN wrote:
Hi,
I posted this in another thread but without any response.
This code:
void main(){
goto Q;
int x;
Q:
writeln("a");
}
Gives me this error: "source_file.d(4): Error: goto skips
declaration of variable
On Monday, 5 November 2018 at 13:26:18 UTC, Per Nordlöw wrote:
AFAICT, it looks like a missing bool qualifier on
`opCast!bool`, right?
...Like a missing 'const' qualifier ;)
auto findSplit(alias pred = "a == b", R1, R2)(R1 haystack, R2
needle)
// ...
static struct Result(S1, S2) if
On Monday, 5 November 2018 at 05:55:02 UTC, unprotected-entity
wrote:
On Saturday, 3 November 2018 at 21:28:22 UTC, Stanislav Blinov
wrote:
The only difference is that `func` became a member function.
And now what? You can just as easily "forget" what's in your
struct/class as in
On Saturday, 3 November 2018 at 14:26:02 UTC, dwdv wrote:
Assoc array allocations?
Yup. AAs do keep their memory around (supposedly for reuse). You
can insert calls to GC.stats (import core.memory) at various
points to see actual GC heap usage. If you don't touch that AA at
all you'll only
On Saturday, 3 November 2018 at 20:38:29 UTC, unprotected-entity
wrote:
As has been pointed out several times before, this is a contrived
example. Allow a simple transformation:
```
module test;
struct S
{
private uint a;
void setA(uint n)
{
// damn implicit
On Saturday, 3 November 2018 at 17:26:19 UTC, Ecstatic Coder
wrote:
void main() {
double value = -12.000123456;
int precision = 50;
import std.stdio;
writefln("%.*g", precision, value);
import std.format;
string str = format("%.*g", precision, value);
On Saturday, 3 November 2018 at 13:20:22 UTC, Ecstatic Coder
wrote:
On Saturday, 3 November 2018 at 12:45:03 UTC, Danny Arends
wrote:
How can I convert a double value -12.000123456 to its string
value "-12.000123456", i.e. without loosing double-precision
digits ?
Specify how many digits
On Thursday, 1 November 2018 at 20:33:10 UTC, Neia Neutuladh
wrote:
On Thu, 01 Nov 2018 20:01:51 +, Stanislav Blinov wrote:
Check if an UDA is a type?.. As in, not just `is(uda == Foo)`,
but simply `is(uda)`:
Which works, but generally makes things more complex in code
that's already
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:
struct Foo { string name = "unknown"; }
@Foo int bar;
`bar` has the *type* Foo as an attribute. It's not
On Wednesday, 31 October 2018 at 13:37:07 UTC, rikki cattermole
wrote:
On 01/11/2018 2:33 AM, Stanislav Blinov wrote:
On Wednesday, 31 October 2018 at 13:28:54 UTC, rikki
cattermole wrote:
But at the end of the day, it just depends on the scope of
the module. Is it getting to large? If so
On Wednesday, 31 October 2018 at 13:28:54 UTC, rikki cattermole
wrote:
But at the end of the day, it just depends on the scope of the
module. Is it getting to large? If so, split.
Yup. LOC aren't a particulalry informative metric. Documentation,
comments, unit tests, blanks, all contribute
On Wednesday, 31 October 2018 at 12:13:57 UTC, Codifies wrote:
On Wednesday, 31 October 2018 at 12:09:04 UTC, Stanislav Blinov
wrote:
```
void printValue(Args...)(Font fnt, float x, float y, string
frmt, auto ref Args args) {
// ...
import std.functional : forward;
string
On Wednesday, 31 October 2018 at 11:53:52 UTC, Codifies wrote:
void printValue(Font fnt,float x, float y, string frmt, ...)
{
/* matrix math and other stuff removed for readability */
string message = format(frmt, _arguments);
is there some way to somehow transfer my input variadic
On Monday, 29 October 2018 at 00:01:21 UTC, DanielG wrote:
In my D app I'm declaring it this way:
extern (C) {
extern __gshared int myIntValue;
int myIntFunc (int a, int b);
}
The function seems to link OK, but the C global will not.
Should it be extern(Windows),
On Sunday, 28 October 2018 at 12:38:12 UTC, ikod wrote:
and object.opEquals(a,b) do not inherits safety from class C
properties, and also I can't override it.
Yep. Since Object is the base class and it defines opEquals as:
```
bool opEquals(Object);
```
the compiler rewrites `a == b` as
On Thursday, 25 October 2018 at 13:22:36 UTC, Eduard Staniloiu
wrote:
The spec doesn't exactly say it uses memset, but it does imply
it:
https://dlang.org/spec/arrays.html#array-copying
talking about "aggressive parallel code optimizations than
possible with the serial semantics of C" and
101 - 200 of 885 matches
Mail list logo