On Thursday, 5 October 2023 at 22:32:36 UTC, mw wrote:
So ModuleInfo contains all the modules (transitive closure)
built into the current binary that is running?
Is there document about this ModuleInfo?
I only find Struct object.ModuleInfo
https://dlang.org/library/object/module_info.html
On Thursday, 5 October 2023 at 22:24:06 UTC, mw wrote:
On Thursday, 5 October 2023 at 21:41:38 UTC, cc wrote:
If you have `T info`, T.tupleof[n] will always match up with
info.tupleof[n]. You can think of `info.tupleof[n]` as being
rewritten by the compiler in-place as
info.whateverFieldTha
On Thursday, 5 October 2023 at 21:25:54 UTC, cc wrote:
So how about at runtime? I just want the compiler to help to
list them, instead of doing manually.
At runtime, simply:
```d
foreach (m; ModuleInfo) {
writeln(m.name);
}
```
However, Walter has hinted that he wants to remove Modul
On Thursday, 5 October 2023 at 21:41:38 UTC, cc wrote:
If you have `T info`, T.tupleof[n] will always match up with
info.tupleof[n]. You can think of `info.tupleof[n]` as being
rewritten by the compiler in-place as info.whateverFieldThatIs.
You might try this version (note the double {{ }}
On Sunday, 1 May 2016 at 09:42:37 UTC, ParticlePeter wrote:
I am logging arbitrary POD struct types with member names and
data:
void printStructInfo( T )( T info ) {
foreach( i, A; typeof( T.tupleof )) {
enum attribName = T.tupleof[i].stringof;
writefln( "%s : %s", attribName, mixin(
On Thursday, 5 October 2023 at 20:42:26 UTC, mw wrote:
On Thursday, 5 October 2023 at 20:07:38 UTC, user1234 wrote:
No. Sorry.
Generally compile time code cannot interact with the system.
To be evaluable at compile time code has to be strongly pure,
that is not the case of the function you wo
On Thursday, 5 October 2023 at 16:40:49 UTC, Gaurav Negi wrote:
Well, in the D programming language, both opIndex and opSlice
are two different operators used to access elements of a custom
type.
Yeah, D is on its way to becoming a near-perfect programming
language...
```d
enum initialSitua
On Thursday, 5 October 2023 at 20:42:26 UTC, mw wrote:
On Thursday, 5 October 2023 at 20:07:38 UTC, user1234 wrote:
No. Sorry.
Generally compile time code cannot interact with the system.
To be evaluable at compile time code has to be strongly pure,
that is not the case of the function you wo
On Thursday, 5 October 2023 at 20:07:38 UTC, user1234 wrote:
No. Sorry.
Generally compile time code cannot interact with the system. To
be evaluable at compile time code has to be strongly pure, that
is not the case of the function you would need.
Otherwise you'd need a new traits for that..
On Thursday, 5 October 2023 at 12:00:22 UTC, Timon Gehr wrote:
void opIndexAssign(int value, int index){ i[index] = value; }
In this case I need to define many operator overloads. For
example (+=), this won't work without returns ref:
```d
s[1] += 3;
assert(s.i == [2, 45]);
// Error: n
On Thursday, 5 October 2023 at 18:40:36 UTC, mw wrote:
On Saturday, 24 November 2018 at 15:21:57 UTC, Anonymouse wrote:
On Saturday, 24 November 2018 at 08:44:19 UTC, Domain wrote:
I have a package named command, and many modules inside it,
such as command.build, command.pack, command.help...
I
On Saturday, 24 November 2018 at 15:21:57 UTC, Anonymouse wrote:
On Saturday, 24 November 2018 at 08:44:19 UTC, Domain wrote:
I have a package named command, and many modules inside it,
such as command.build, command.pack, command.help...
I want to get all these modules at compile time so that I
On Wednesday, 4 October 2023 at 10:51:46 UTC, dhs wrote:
D and Go slices have advantages but can be confusing. I don't
have a solution, but if anyone is interested, the relevant
discussions about slice confusion in the Go community apply to
D slices as well.
I don't believe slice confusion
Well, in the D programming language, both opIndex and opSlice are
two different operators used to access elements of a custom type.
struct S(T)
{
T[] arr;
T opIndex(size_t index) const
{
assert(index < arr.length, "Index out of range");
re
On 10/5/23 1:49 AM, ag0aep6g wrote:
For some further reading, there's an open issue about the unexpected
slicing: https://issues.dlang.org/show_bug.cgi?id=14619
Thank you I had forgotten about that issue!
-Steve
On 10/3/23 00:11, Salih Dincer wrote:
Hi,
opIndexAssign, which is void, cannot compromise with opIndex, which is a
ref! Solution: Using opSliceAssign. Could this be a bug? Because
there is no problem in older versions (e.g. v2.0.83).
```d
struct S
{
int[] i;
ref opIndex(size_t inde
16 matches
Mail list logo