On 02.08.21 22:14, vit wrote:
Why this doesn't work:
```d
template DestructorType(T){
alias Get(T) = T;
alias DestructorType = Get!(typeof((void*){
T tmp;
}));
}
struct Foo{
~this()@safe{}
}
```
```d
void main(){
//Error: static assert: `is(void function(v
On Wednesday, 4 August 2021 at 01:10:15 UTC, Mike Parker wrote:
On Tuesday, 3 August 2021 at 21:40:09 UTC, james.p.leblanc
wrote:
[...]
The alias to Complex!double is a template instantiation. A
template instantiation creates a symbol that needs to be
linked. So you need to compile my_module
On 8/3/21 9:51 PM, Brian Tiffin wrote:
> I added an `import std.json;`. That did not include the
> JSONType enum.
It works for me:
import std.json;
int main() {
return JSONType.null_;
}
> Is there a go to quick and easy way of tracking down
> module members?
Searching for it at dlang.org
Just tried the JSON sample from the home page. It's not an all
in listing, so I added an `import std.json;`. That did not
include the JSONType enum. A little more looking around, a more
complete listing, added
```
import std.array;
import std.conv;
import std.range.primitives;
import std.tr
On Tuesday, 3 August 2021 at 20:29:10 UTC, NonNull wrote:
On Tuesday, 3 August 2021 at 17:01:38 UTC, Mike Parker wrote:
On Tuesday, 3 August 2021 at 16:43:52 UTC, NonNull wrote:
how does it work for recursive types like a struct containing
a pointer to a struct of the same type
A struct `S` w
On Tuesday, 3 August 2021 at 21:40:09 UTC, james.p.leblanc wrote:
I am getting linker errors with this stripped-down example:
---
**my_main.d:**
import std.stdio;
import std.complex;
import my_module;
void main(){
my_TYPE xxx;
wr
I am getting linker errors with this stripped-down example:
---
**my_main.d:**
import std.stdio;
import std.complex;
import my_module;
void main(){
my_TYPE xxx;
writeln(xxx);
}
---
**my
On Tuesday, 3 August 2021 at 17:14:42 UTC, Ali Çehreli wrote:
On 8/3/21 9:43 AM, NonNull wrote:
I'd like to understand how any D type is represented as a
string by the name mangling done by the compilers.
Related article that mentions .mangleof, a property of all
symbols:
https://dlang.or
On Tuesday, 3 August 2021 at 17:01:38 UTC, Mike Parker wrote:
On Tuesday, 3 August 2021 at 16:43:52 UTC, NonNull wrote:
how does it work for recursive types like a struct containing
a pointer to a struct of the same type
A struct `S` with a member of type `S*` is still just a struct
`S`. The
On 8/3/21 12:22 PM, frame wrote:
On Tuesday, 3 August 2021 at 19:19:27 UTC, jfondren wrote:
On Tuesday, 3 August 2021 at 19:11:16 UTC, frame wrote:
On Tuesday, 3 August 2021 at 16:35:04 UTC, Ali Çehreli wrote:
Why foreach() does not accept a pointer?
pointers don't come with a length?
Where
On Tuesday, 3 August 2021 at 19:19:27 UTC, jfondren wrote:
On Tuesday, 3 August 2021 at 19:11:16 UTC, frame wrote:
On Tuesday, 3 August 2021 at 16:35:04 UTC, Ali Çehreli wrote:
Why foreach() does not accept a pointer?
pointers don't come with a length?
Where is the problem if it points to so
On Tuesday, 3 August 2021 at 19:11:16 UTC, frame wrote:
On Tuesday, 3 August 2021 at 16:35:04 UTC, Ali Çehreli wrote:
Why foreach() does not accept a pointer?
pointers don't come with a length?
On Tuesday, 3 August 2021 at 16:35:04 UTC, Ali Çehreli wrote:
a) Classes are already reference types. So, replace struct with
class:
class Foo {
// ...
}
It's already a member of an object, so I don't like it to make it
a sub object.
b) Make your struct a reference type by
i) Renamin
On Tuesday, 3 August 2021 at 17:57:47 UTC, Ali Çehreli wrote:
On 8/3/21 10:50 AM, james.p.leblanc wrote:
> **Is there some highly visible place this is already
documented?
For what it's worth, it appears as "slice from pointer" in my
index:
http://ddili.org/ders/d.en/pointers.html#ix_pointe
On 8/3/21 10:50 AM, james.p.leblanc wrote:
> **Is there some highly visible place this is already documented?
For what it's worth, it appears as "slice from pointer" in my index:
http://ddili.org/ders/d.en/pointers.html#ix_pointers.slice%20from%20pointer
Admittedly, one needs to know the conc
On Tuesday, 3 August 2021 at 16:32:34 UTC, kinke wrote:
On Tuesday, 3 August 2021 at 12:33:56 UTC, james.p.leblanc
wrote:
Concise question:
=
I would like to use dynamic arrays, not for their
dynamic sizing properties per se' (slicing, appending, etc).
But, more for their memory
On 8/3/21 9:43 AM, NonNull wrote:
I'd like to understand how any D type is represented as a string by the
name mangling done by the compilers.
Related article that mentions .mangleof, a property of all symbols:
https://dlang.org/blog/2017/12/20/ds-newfangled-name-mangling/
Ali
On Tuesday, 3 August 2021 at 16:43:52 UTC, NonNull wrote:
how does it work for recursive types like a struct containing a
pointer to a struct of the same type
A struct `S` with a member of type `S*` is still just a struct
`S`. The pointer doesn't change anything about the type.
On Tuesday, 3 August 2021 at 16:43:52 UTC, NonNull wrote:
I'd like to understand how any D type is represented as a
string by the name mangling done by the compilers.
Does this always have the desirable property that different
types have different mangled names, so that a type is
faithfully r
I'd like to understand how any D type is represented as a string
by the name mangling done by the compilers.
Does this always have the desirable property that different types
have different mangled names, so that a type is faithfully
represented by its mangled string incorporated into a symbol
On 8/2/21 4:06 PM, frame wrote:
Is there a way to find a struct which should be passed by reference but
accidentally isn't? Maybe with copy constructors?
If I understand it correctly, your current value-type needs to be a
reference type. Would the following be workable solutions?
a) Classes
On Tuesday, 3 August 2021 at 12:33:56 UTC, james.p.leblanc wrote:
Concise question:
=
I would like to use dynamic arrays, not for their
dynamic sizing properties per se' (slicing, appending, etc).
But, more for their memory protection and efficiencies (for
example,using foreach).
On Tuesday, 3 August 2021 at 13:23:04 UTC, Tejas wrote:
No. ```ref``` can only be used as a function/template. or
```foreach``` parameter.
Yeah, I know. I was in hope of a DIP or something.
I just would like to hijack the reference chain to do something
like:
```d
void fun()
{
ref T rs;
On Tuesday, 3 August 2021 at 12:23:38 UTC, frame wrote:
On Tuesday, 3 August 2021 at 11:55:51 UTC, Paul Backus wrote:
You can't assign a `ref` to a variable; if you try, a copy is
created.
What you can do instead is use a pointer:
```d
Unique!myType* rs = &query();
```
Thanks. I feared tha
Concise question:
=
I would like to use dynamic arrays, not for their
dynamic sizing properties per se' (slicing, appending, etc).
But, more for their memory protection and efficiencies (for
example,using foreach).
However, I must have the start of my array at an avx
friendly 32
On Tuesday, 3 August 2021 at 11:55:51 UTC, Paul Backus wrote:
You can't assign a `ref` to a variable; if you try, a copy is
created.
What you can do instead is use a pointer:
```d
Unique!myType* rs = &query();
```
Thanks. I feared that. So something like
```
ref T var = ...
```
does not e
On Tuesday, 3 August 2021 at 10:28:53 UTC, Rekel wrote:
On Tuesday, 3 August 2021 at 00:53:43 UTC, user1234 wrote:
You got the answer in another reply but here is a bit of more
fun:
```d
void main() {
return cast(void) 1;
}
```
What does casting to void do? Does it just ignore whatever
On Tuesday, 3 August 2021 at 11:31:02 UTC, frame wrote:
On Tuesday, 3 August 2021 at 10:25:34 UTC, frame wrote:
This could work, thanks for the hint.
I was too optimistic. I get the error:
```
struct `std.typecons.Unique!(myType).Unique` is not copyable
because it is annotated with `@disabl
On Tuesday, 3 August 2021 at 10:25:34 UTC, frame wrote:
This could work, thanks for the hint.
I was too optimistic. I get the error:
```
struct `std.typecons.Unique!(myType).Unique` is not copyable
because it is annotated with `@disable`
```
on a line like:
```d
Unique!myType rs = query()
On Monday, 2 August 2021 at 23:19:48 UTC, jfondren wrote:
On Monday, 2 August 2021 at 23:06:42 UTC, frame wrote:
Is there a way to find a struct which should be passed by
reference but accidentally isn't? Maybe with copy constructors?
@disable postblit:
Well, I have to change a struct to be
On Tuesday, 3 August 2021 at 00:53:43 UTC, user1234 wrote:
You got the answer in another reply but here is a bit of more
fun:
```d
void main() {
return cast(void) 1;
}
```
What does casting to void do? Does it just ignore whatever
follows it?
On Tuesday, 3 August 2021 at 07:23:34 UTC,
On Monday, 2 August 2021 at 14:46:36 UTC, jfondren wrote:
On Monday, 2 August 2021 at 14:31:45 UTC, Rekel wrote:
[...]
I don't know where you can find this in the docs, but what
doesn't seem trivial about it? The type of the expression
`print()` is void. That's the type that `doSomething` re
32 matches
Mail list logo