On Saturday, 6 February 2021 at 00:35:12 UTC, Ali Çehreli wrote:
On 2/5/21 1:10 PM, Rumbu wrote:
I gave up after reading a lot, but I didn't manage to
understand the meaning "&& ..."
I think it's the universal reference.
Thank you Ali, but nope, it's "parameter pack folding". This
allows
On Friday, 5 February 2021 at 21:10:21 UTC, Rumbu wrote:
Can some C++ guru translate in D the template below?
I gave up after reading a lot, but I didn't manage to
understand the meaning "&& ..."
template static uint8_t
composite_index_size(Tables const&... tables) { return
On Saturday, 6 February 2021 at 09:42:38 UTC, rikki cattermole
wrote:
On 06/02/2021 3:32 PM, frame wrote:
[...]
This won't do anything.
[...]
Don't forget to stdout.flush; Otherwise stuff can get caught in
the buffer before erroring out.
[...]
Turn on the precise GC, 32bit is a
On 07/02/2021 12:38 AM, Siemargl wrote:
On Saturday, 6 February 2021 at 11:20:18 UTC, Imperatorn wrote:
On Saturday, 6 February 2021 at 09:42:38 UTC, rikki cattermole wrote:
On 06/02/2021 3:32 PM, frame wrote:
[...]
This won't do anything.
[...]
Don't forget to stdout.flush; Otherwise
On 06/02/2021 3:32 PM, frame wrote:
On Friday, 5 February 2021 at 22:46:05 UTC, Bastiaan Veelo wrote:
?? Do you mean no collections happen? 32bit GC should just work.
No, it doesn't - this code fails on memory allocation and works fine
with -m64 switch:
import std.stdio;
import
On Saturday, 6 February 2021 at 11:20:18 UTC, Imperatorn wrote:
On Saturday, 6 February 2021 at 09:42:38 UTC, rikki cattermole
wrote:
On 06/02/2021 3:32 PM, frame wrote:
[...]
This won't do anything.
[...]
Don't forget to stdout.flush; Otherwise stuff can get caught
in the buffer
I'm trying to get the values of an enum at compile-time and
running into a behavior I don't understand.
Consider the following enum:
enum A {x="foo", y="bar"}
And now, I just want to print out the values of A at runtime
(e.g. A.x = "foo").
void main()
{
static foreach(i, op;
```p.d
module pp;
void foo ()
{
import std.stdio: writeln;
__PRETTY_FUNCTION__.writeln;
}
```
```x.d
import p;
```
```main.d
import x;
unittest {
import pp: foo; // wrong name is accepted if x is imported
// import p: foo;
foo;
}
```
$ dmd -i -unittest -main -run main
void
On Saturday, 6 February 2021 at 14:39:38 UTC, Jeff wrote:
Okay, the above works. But, I'm not sure why?
Phobos's enum conversion always looks at the identifier, whereas
the rest of the language looks at the value. Remember phobos'
writeln forwards to the rest of its conversions just like
On Saturday, 6 February 2021 at 10:44:08 UTC, Siemargl wrote:
On Saturday, 30 January 2021 at 20:32:36 UTC, Siemargl wrote:
No, this is a deadlock in memory manager.
To find roots of problem, needed a debug version of druntime,
but i were unsuccesfull to compile it.
I make debug vesion of
On Saturday, 6 February 2021 at 13:30:03 UTC, rikki cattermole
wrote:
Okay, its still seeing something is alive then.
That's why I used the scope guard. I know it shouldn't have any
effect but I want to give the GC an extra hint ;)
I've compiled and ran it under ldc. Dmd in 32bit mode is
On Saturday, 30 January 2021 at 20:32:36 UTC, Siemargl wrote:
No, this is a deadlock in memory manager.
To find roots of problem, needed a debug version of druntime,
but i were unsuccesfull to compile it.
I make debug vesion of druntime and catch nicer stacktrace. Maybe
this can help
On Saturday, 6 February 2021 at 14:39:38 UTC, Jeff wrote:
So, I'm guessing there's something going on under-the-hood
using the ~ operator with the enum and I'd like to understand
what it is.
Enum to string conversion is usually implemented using the name
of the enum member, regardless of
Module names and file names are completely independent on the
language level. You can have a file `whatever.d` with `module
foo.bar.totally.different;` and `import
foo.bar.totally.different` and it all works as long as you add
the whatever.d to the build.
The only reason people recommend
On Saturday, 6 February 2021 at 14:52:57 UTC, Adam D. Ruppe wrote:
[...]
That one `import p;` is kinda weird, it should probably
complain then you imported one thing and got another, but
generally the name not matching is no problem at all.
```main.d (version 2)
// import x;
unittest {
//
Also wanted to note that if I do:
string enumValue = op;
writeln(enumValue);
Then it also outputs foo and bar. So, why would the behavior of
op.to!string not be the same?
On Saturday, 6 February 2021 at 15:00:45 UTC, Adam D. Ruppe wrote:
On Saturday, 6 February 2021 at 14:39:38 UTC, Jeff wrote:
Okay, the above works. But, I'm not sure why?
Phobos's enum conversion always looks at the identifier,
whereas the rest of the language looks at the value.
...
Hi,
lets say i want to create a function that returns multiple values
- e.g. Tuple!(string,string).
Why/when i should prefer Tuple as a return type over returning a
struct (or even string[2] in this case)?
Thank you
On Saturday, 6 February 2021 at 18:02:46 UTC, Martin wrote:
Why/when i should prefer Tuple as a return type over returning
a struct (or even string[2] in this case)?
A Tuple is just a struct declared inlined. I personally use
struct every single time - structs can be separately documented
On Saturday, 6 February 2021 at 19:13:33 UTC, Mike Parker wrote:
On Saturday, 6 February 2021 at 17:50:18 UTC, frame wrote:>
But .length = 0 should.
What do you expect it to do in this case?
Don't know - some compiler optimization? :D
On Saturday, 6 February 2021 at 19:31:39 UTC,
On 07/02/2021 4:22 AM, frame wrote:
On Saturday, 6 February 2021 at 13:30:03 UTC, rikki cattermole wrote:
Okay, its still seeing something is alive then.
That's why I used the scope guard. I know it shouldn't have any effect
but I want to give the GC an extra hint ;)
The GC shouldn't be
On Sunday, 29 December 2019 at 08:26:58 UTC, Daren Scot Wilson
wrote:
Reading documentation... Array, Algorithms, ... maybe I've been
up too late... how does one obtain the index of, say, 55 in an
array like this
int[] a = [77,66,55,44];
I want to do something like:
int i =
On 06.02.21 16:05, kdevel wrote:
On Saturday, 6 February 2021 at 14:52:57 UTC, Adam D. Ruppe wrote:
[...]
That one `import p;` is kinda weird, it should probably complain then
you imported one thing and got another, but generally the name not
matching is no problem at all.
```main.d
On Saturday, 6 February 2021 at 15:45:47 UTC, rikki cattermole
wrote:
The GC shouldn't be aware of the scope guard. It expands out
into a try finally block.
But .length = 0 should.
Nah, this is old. It is also bad D code.
Allocate up front and then set.
I agree but it has to work
On Saturday, 6 February 2021 at 17:50:18 UTC, frame wrote:>
But .length = 0 should.
What do you expect it to do in this case?
On Saturday, 6 February 2021 at 19:10:14 UTC, Mike Parker wrote:
On Saturday, 6 February 2021 at 17:50:18 UTC, frame wrote:
On Saturday, 6 February 2021 at 15:45:47 UTC, rikki cattermole
wrote:
Default settings should work out of the box. If not - it's bad
for reputation of the language.
On Saturday, 6 February 2021 at 19:10:14 UTC, Mike Parker wrote:
On Saturday, 6 February 2021 at 17:50:18 UTC, frame wrote:
Sorry, i forgot mem leak. Or maybe i incorrect understand Gc
counters
So log
Usage: 698.46 MiB (free 187.42 MiB) / collected: 14
On Saturday, 6 February 2021 at 15:47:05 UTC, Rumbu wrote:
On Sunday, 29 December 2019 at 08:26:58 UTC, Daren Scot Wilson
wrote:
[...]
Just reactivating this post to tell you that I lost 15 minutes
of my life searching for a basic way to obtain the position of
an element in an array; Out of
On Saturday, 6 February 2021 at 17:50:18 UTC, frame wrote:
On Saturday, 6 February 2021 at 15:45:47 UTC, rikki cattermole
wrote:
Default settings should work out of the box. If not - it's bad
for reputation of the language.
Given that 32-bit has been the default on Windows for D's entire
On 2/6/21 2:26 PM, mw wrote:
On Tuesday, 31 December 2019 at 14:52:55 UTC, Steven Schveighoffer wrote:
On 12/31/19 9:47 AM, Steven Schveighoffer wrote:
for the original example:
int[] a = [77,66,55,44];
int i = a.bwin.find(55).bufRef.pos;
sorry, should be size_t i.
Unsigned?
On Tuesday, 31 December 2019 at 14:52:55 UTC, Steven
Schveighoffer wrote:
On 12/31/19 9:47 AM, Steven Schveighoffer wrote:
for the original example:
int[] a = [77,66,55,44];
int i = a.bwin.find(55).bufRef.pos;
sorry, should be size_t i.
Unsigned?
Then how the function signal
Hi all,
I'm trying to render a diet template out to a WebSocket as a
string to be inserted into a specific portion of the currently
served page. Does anyone know how to go about this?
On Saturday, 6 February 2021 at 22:32:53 UTC, Ali Çehreli wrote:
On 2/6/21 2:26 PM, mw wrote:
On Tuesday, 31 December 2019 at 14:52:55 UTC, Steven
Schveighoffer wrote:
On 12/31/19 9:47 AM, Steven Schveighoffer wrote:
for the original example:
int[] a = [77,66,55,44];
int i =
33 matches
Mail list logo