the specification says that in betterC mode the main function should
have extern(C) linkage. Accidentally I found that dmd does not demand it
in contrast to ldc. Is it bug of dmd or the specification can be relaxed?
On Saturday, 7 March 2020 at 15:44:38 UTC, Arine wrote:
I feel as though that's it's greatest weakness. It makes the
check whether there is or isn't a value hidden. The case when
there isn't a value should be handled explicitly, not
implicitly. Propogating a None value isn't useful and is
On Saturday, 7 March 2020 at 14:33:29 UTC, Steven Schveighoffer
wrote:
It's D's version of implicit conversion.
You can make the alias this a no-arg function and it will try
calling that function.
Okay thank you.
On 2020-03-07 16:40:15 +, Adam D. Ruppe said:
Use regular foreach with a regular string. Put that inside a function.
Then simply use that function to initialize your other thing and enjoy
the magic of CTFE!
Perfect! This implicit CTFE is a tricky thing to see/remember/...
Feeling a bit
On Saturday, 7 March 2020 at 16:30:59 UTC, Robert M. Münch wrote:
Which of course doesn't work... I didn't find any reference how
to build-up strings in a statif foreach loop.
Is this possible at all?
Use regular foreach with a regular string. Put that inside a
function.
Then simply use
On Saturday, 7 March 2020 at 16:30:59 UTC, Robert M. Münch wrote:
Is this possible at all?
You can use an anonymous lambda to build the string in CTFE:
--
struct S {
int a;
bool b;
}
import std;
enum string sql = {
string s = "CREATE
I want to create a "CREATE TABLE data (...)" where the columns are
derived from struct member names. Something like:
string s = "CREATE TABLE data(";
static foreach(f; FieldNameTuple!myStruct) {
s ~= f ~ ",";
}
s ~= ");";
Which of course doesn't work... I didn't find any reference how to
Steve, thank you once again. Now it compiles & runs!
I now create my tree like this:
auto debs = new RedBlackTree!(Deb, (a, b) => a.name < b.name);
(I feel that the rbtree docs are inadequate regarding creating
new empty trees, so have submitted a bug report:
On Saturday, 29 February 2020 at 15:23:02 UTC, Sebastiaan Koppe
wrote:
Like I said, I don't use optionals when I care about errors.
That is not what they are designed for.
If I want to type-guard potential errors I will use SumType!(T,
Error). It forces you to handle both cases, either at
On Saturday, 7 March 2020 at 13:06:39 UTC, Dibyendu Majumdar
wrote:
On Saturday, 7 March 2020 at 12:26:32 UTC, drug wrote:
I am trying to understand
https://github.com/dlang/dmd/blob/master/src/dmd/backend/barray.d.
Two questions:
1. What does this mean and why is it needed?
line 95: alias
On 3/7/20 8:06 AM, Dibyendu Majumdar wrote:
On Saturday, 7 March 2020 at 12:26:32 UTC, drug wrote:
I am trying to understand
https://github.com/dlang/dmd/blob/master/src/dmd/backend/barray.d.
Two questions:
1. What does this mean and why is it needed?
line 95: alias array this;
This
On 3/7/20 8:22 AM, mark wrote:
0x55701ef0 in
_D3std9container6rbtree__T12RedBlackTreeTAyaVQea5_61203c2062Vbi0ZQBn5emptyMFNaNbNdNiNfZb
(this=0x0)
at
/home/mark/opt/ldc2-1.20.0-linux-x86_64/bin/../import/std/container/rbtree.d:967
967 return _end.left is null;
(gdb) bt
07.03.2020 15:58, Steven Schveighoffer пишет:
Hm... I'd say:
1. Don't use a pointer for the element. Just use the struct directly.
Using a pointer is bad because it's now going to compare pointers, and
not the element data. Not only that, but RBNodes are stored as
heap-allocated structs, so
On Saturday, 7 March 2020 at 11:10:01 UTC, Dennis wrote:
On Saturday, 7 March 2020 at 10:49:24 UTC, Paolo Invernizzi
wrote:
Frankly, I simply hate all that shuffle around names ...
I remember someone noting how unusual it is for D to have a
name for its standard library, "Phobos".
There
I've now gone back to using structs direct without pointers but
I'm still doing something wrong.
struct Deb {
string name;
...
RedBlackTree!string tags;
bool valid() { return !(name.empty || description.empty); }
void clear() { name = ""; ...; tags.clear; }
}
On Saturday, 7 March 2020 at 12:26:32 UTC, drug wrote:
I am trying to understand
https://github.com/dlang/dmd/blob/master/src/dmd/backend/barray.d.
Two questions:
1. What does this mean and why is it needed?
line 95: alias array this;
This means that `array` can be used instead of `this`
On 3/7/20 7:26 AM, drug wrote:
07.03.2020 15:05, Dibyendu Majumdar пишет:
Hi,
I am trying to understand
https://github.com/dlang/dmd/blob/master/src/dmd/backend/barray.d.
Two questions:
1. What does this mean and why is it needed?
line 95: alias array this;
This means that `array` can
On 3/7/20 5:58 AM, mark wrote:
change #1:
if (line.empty) {
if (deb != null && deb.valid)
debs.insert(deb);
else // report incomplete
deb = null;
continue;
07.03.2020 15:05, Dibyendu Majumdar пишет:
Hi,
I am trying to understand
https://github.com/dlang/dmd/blob/master/src/dmd/backend/barray.d.
Two questions:
1. What does this mean and why is it needed?
line 95: alias array this;
This means that `array` can be used instead of `this`
2. The
07.03.2020 13:58, mark пишет:
change #1:
if (line.empty) {
if (deb != null && deb.valid)
debs.insert(deb);
else // report incomplete
deb = null;
continue;
On Saturday, March 7, 2020 2:43:47 AM MST Robert M. Münch via Digitalmars-d-
learn wrote:
> It looks like std.datetime is not anticipating the +1:00 part of a date
> like: "2018-11-06T16:52:03+01:00"
>
> Those dates are used all over on the internet and I'mm wondering why
> it's not supported. Any
Hi,
I am trying to understand
https://github.com/dlang/dmd/blob/master/src/dmd/backend/barray.d.
Two questions:
1. What does this mean and why is it needed?
line 95: alias array this;
2. The struct has no property called length - but this is
referenced. Where does this come from?
Thank
On Saturday, 7 March 2020 at 10:49:24 UTC, Paolo Invernizzi wrote:
On Saturday, 7 March 2020 at 09:31:27 UTC, JN wrote:
Do we have any cool name for Dub packages?
tapes.
Rust has 'crates'
Crystal has 'shards'
Python has 'wheels'
Ruby has 'gems'
Frankly, I simply hate all that shuffle
On Saturday, 7 March 2020 at 10:49:24 UTC, Paolo Invernizzi wrote:
Frankly, I simply hate all that shuffle around names ...
I remember someone noting how unusual it is for D to have a name
for its standard library, "Phobos".
change #1:
if (line.empty) {
if (deb != null && deb.valid)
debs.insert(deb);
else // report incomplete
deb = null;
continue;
}
if (deb == null)
Instead of deb.clear I'm now doing deb = null;
On Saturday, 7 March 2020 at 09:31:27 UTC, JN wrote:
Do we have any cool name for Dub packages?
Rust has 'crates'
Crystal has 'shards'
Python has 'wheels'
Ruby has 'gems'
Frankly, I simply hate all that shuffle around names ... it's so
difficult to understand people when it's referring to
On Saturday, 7 March 2020 at 10:30:06 UTC, drug wrote:
07.03.2020 13:20, mark пишет:
I have this struct (with details omitted
[ snip ]
Should Deb be a class rather than a struct?
Do you consider using pointers in AA:
```
Deb*[string] debForName;
```
I've done some changes including using
07.03.2020 13:20, mark пишет:
I have this struct (with details omitted
[ snip ]
Should Deb be a class rather than a struct?
Do you consider using pointers in AA:
```
Deb*[string] debForName;
```
I have this struct (with details omitted ... for brevity):
struct Deb {
string name;
...
RedBlackTree!string tags;
void clear() { name = ""; ...; tags.clear; }
bool valid() { return !(name.empty || description.empty); }
}
I plan to store >65K of these (with potential for
It looks like std.datetime is not anticipating the +1:00 part of a date
like: "2018-11-06T16:52:03+01:00"
Those dates are used all over on the internet and I'mm wondering why
it's not supported. Any reason? Is this +01:00 not ISO conforming?
--
Robert M. Münch
http://www.saphirion.com
Do we have any cool name for Dub packages?
Rust has 'crates'
Crystal has 'shards'
Python has 'wheels'
Ruby has 'gems'
32 matches
Mail list logo