On 1/4/23 13:43, H. S. Teoh wrote:
> You do realize that the compiler is free to reorder local variables on
> the stack, right? ;-)
Of course. :)
I was trying different strategies to catch the compiler (dmd here) in a
single act of 8-byte object alignment as reported by .alignof.
Another
On 1/4/23 12:02, Steven Schveighoffer wrote:
> On 1/4/23 2:27 PM, Ali Çehreli wrote:
>> I put the objects into a 2-length
>> static array but the difference was still 0x20. (?)
>
> Are you putting the class *references* in a 2-length static array?
I lied. As I could not put the objects in a
On 1/4/23 11:27, Ali Çehreli wrote:
> writeln("hidden 0: ", hiddenValue(addr, 0));
> writeln("hidden 1: ", hiddenValue(addr, 1));
Silly me! :) Those members have names:
writeln("__vptr : ", obj.__vptr);
writeln("__monitor : ", obj.__monitor);
On 1/4/23 10:48, H. S. Teoh wrote:
> Allocations are not necessarily consecutive; the GC may have its own
> strategy of allocation that doesn't follow a linear sequence.
That was one of my guesses. So, I put the objects into a 2-length static
array but the difference was still 0x20. (?)
>
On 1/3/23 20:01, Paul wrote:
> Size Alignment Type
> =
>17 8 MyClass
>
> MyClassObj1 MyClassObj2
> 27727202000 27727202020
> ```
> If my size is 17 bytes and my alignment is 8 bytes, shouldn't my
> MyClassObj2 in this example be @
On 1/3/23 20:11, thebluepandabear wrote:
> if I replace the `isDrawable` template with the
> following (using `typeof`), the code does not compile:
It must be because T is already a type. It's the same reason why the
following code fails to compile:
void main() {
alias T = int;
alias
On 1/3/23 19:42, thebluepandabear wrote:
> @property {
As your post proves, that feature is at most half-baked and is
discouraged. Today, there is just one known obscure effect of using it.
> void name(string name) {
> _name = name;
> }
> d.name =
On 1/1/23 01:01, Paul wrote:
> ...on my laptop it prints...
> ```
> Size Alignment Type
> =
> 9 4 MyClass
>
> 4FFB20 4FFB24
> ```
> If the size of MyClass is 9 bytes why do MyClassO1 & O2 addresses only
> differ by 4 bytes?
As matheus said, classes
On 12/31/22 16:42, H. S. Teoh wrote:
> "runtime"
Going off topic, I've settled on three different spelling of that
(those? :) ):
- run time: As in this topic, things can happen at run time.
- run-time: Adjective, as in run-time value of something.
- runtime: The D runtime.
Ali
On 12/31/22 16:35, Paul wrote:
> Can I acquire the address of a class object,
Answering that question literally, yes, you can by casting the class
variable to void*. But note: 'class object' means the instance of class
in D.
> not a class variable (i.e.
> the instantiations of the class)
D
On 12/30/22 17:22, Salih Dincer wrote:
> I guess there is no other way but to overload.
Since the bodies of all three overloads are the same except some types,
they can easily be templatized.
> This is both the safest and the fastest.
I didn't think Values is fast with string copies that it
On 12/30/22 13:54, matheus wrote:
> But yes I think it will generate a copy (mutable) based on this test:
In this case it does copy but in the case of dchar[] to dchar[], there
will be no copy. Similarly, there is no copy from immutable to immutable.
> the address is different
Good test. :)
On 12/28/22 08:04, Ali Çehreli wrote:
> I don't think any of them can run the program though because
> the program can be in a state that could harm its environment
> like deleting unwanted files.
I was too eager there. Likely no IDE goes that far. All they need is to
understand the code
On 12/27/22 18:31, thebluepandabear wrote:
> What I do understand is that compile time and run time are the two
> processes that your code goes through to be executed natively.
There is a confusion: Compile time ends when the compiler generates the
executable program, one that will be executed
On 12/27/22 07:09, Sergei Nosov wrote:
> Basically, my idea is to apply `indexed` to an array several times and
> have all the intermediaries saved in the same variable.
There may be other ways of achieving the same goal without assigning to
the same variable.
> I wonder, if there's a way to
On 12/24/22 09:58, jwatson-CO-edu wrote:
>> ~static this()
Should be 'static ~this()'.
>> ~shared static this()
Should be 'shared static ~this()'.
> thank you all
Happy to be helpful...
Ali
On 12/24/22 08:18, jwatson-CO-edu wrote:
> On Friday, 23 December 2022 at 07:25:23 UTC, Salih Dincer wrote:
>> You can try using static this.
>>
>> ```d
>> import std.random;
>>
>> static this() { } // can try using
static this() blocks: executed when a thread a starts (the program has
at least
On 12/21/22 16:43, thebluepandabear wrote:
> Say you have the following function that takes in a `ref` parameter:
>
> ```D
> void modify(ref int num) {
> num += 5;
> }
> ```
>
> Does the compiler turn that into the code below?
>
> ```D
> void modify(int* num) {
> num += 5;
Rather:
On 12/19/22 14:14, thebluepandabear wrote:
> Yeah I am sure it was on this thread. One of the posts was at
> https://forum.dlang.org/post/kzvnajixjdnlcupsl...@forum.dlang.org, it
> now shows 'Not Found'.
Then I don't know. (?)
However, I realize my ThunderBird "evidence" is useless because if
On 12/19/22 13:45, thebluepandabear wrote:
> On Monday, 19 December 2022 at 21:41:45 UTC, thebluepandabear wrote:
>> Why did my replies here to someone else get deleted?
>
> Myself and this other person's reply to this thread randomly got removed
> for no reason, I would appreciate an explanation
On 12/18/22 08:21, Salih Dincer wrote:
> Don't you think it's interesting that it doesn't need unary operator
> overloading?
Yes, it is interesting. I put comments to explain it to myself:
import std.stdio;
struct S
{
int value;
/* The folowing declaration allows objects of this type
On 12/16/22 18:20, H. S. Teoh wrote:
> scratch space for computations, called the runtime
> stack.
I called it "function call stack" where I gave a very simplistic view of
it here:
https://www.youtube.com/watch?v=NWIU5wn1F1I=236s
> (2) Use @safe when possible so that the compiler will
On 12/15/22 11:31, Nick Treleaven wrote:
> On Wednesday, 14 December 2022 at 17:41:07 UTC, Ali Çehreli wrote:
>> I've never used Unique but I think it has a bug (or a design issue?):
>> Its destructor is the following:
>>
>> ~this()
>> {
>> if (_p !is null)
>> {
>>
On 12/14/22 09:41, Ali Çehreli wrote:
> // According to documentation, the handler must be created
dynamically:
> // We make a unique owner for it:
Ignore that part. It's a leftover from my experiments with Unique!Handle.
Ali
On 12/14/22 05:58, Vitaliy Fadeev wrote:
> On Wednesday, 14 December 2022 at 11:30:07 UTC, Vitaliy Fadeev wrote:
>> How to define HANDLE var ? What to return from procedure? How to call
>> CloseHandle( h ) when variable destroyed?
An obvious way is an RAII type where the destructor calls
On 12/13/22 14:21, areYouSureAboutThat wrote:
> On Saturday, 10 December 2022 at 15:59:07 UTC, Ali Çehreli wrote:
>>
>> ... Object orientation don't go well with collections
>
> On what basis do you make that assertion?
You stripped my answer.
> i.e. Which aspect of OOP programming 'don't
On 12/11/22 01:25, zjh wrote:
> On Sunday, 11 December 2022 at 04:36:45 UTC, thebluepandabear wrote:
>
>> "The main reason for this limitation is the fact that a function
>> taking a ref
>> parameter can hold on to that reference for later use, at a time when
>> the rvalue
>> would not be
On 12/11/22 05:54, Salih Dincer wrote:
> On Sunday, 11 December 2022 at 09:43:34 UTC, Andrey Zherikov wrote:
>> Note that callback parameter must be compile-time parameter as it
>> represents a member of a type during introspection done by `foo`.
>
> I can't quite understand the question, this
On 12/9/22 22:11, thebluepandabear wrote:
> I was wondering more if there is an object oriented way of creating
> arrays,
Every collection has its own special interface. Object orientation don't
go well with collections. For example, you wouldn't want indexing
operator for a linked list.
>
On 12/8/22 08:21, Salih Dincer wrote:
> void stringCopy(Chars)(string source,
> ref Chars target)
>sample.stringCopy = cTxt; // disappeared ? char
Nothing disappeared on my system. (?)
Going off-topic, I find the expression above extremely confusing. I am
used to
On 12/8/22 06:28, johannes wrote:
> enum __FLT128_MAX__ = 1.18973149535723176508575932662800702e+4932F128;
That literal is not legal D. The "F128" characters at the end are extra.
Besides, D does not have a 128-bit floating point type.
Ali
(Sorry for double e-mail.)
On 12/6/22 15:07, johannes wrote:
> 'write' prints out the address
> of the first byte. This is odd to me because printf does the job
> correctly.
printf behaves as what you expect because %s means dereferencing the
pointer values and printing the char contents until printf sees '\0'.
> But
On 12/4/22 18:57, thebluepandabear wrote:
> I am not understanding why Ali said there is a decimal mark if precision
> is nonzero?
>
> How can a number have zero precision?
That "precision" is referring to how many digits are printed after the
decimal mark in the formatted output.
> "the
On 12/4/22 15:25, Adam D Ruppe wrote:
> which would trigger the write barrier. The thread isn't
> allowed to complete this operation until the GC is done.
According to my limited understanding of write barriers, the thread
moving to 800 could continue because order of memory operations may
On 12/4/22 12:17, Adam D Ruppe wrote:
On Sunday, 4 December 2022 at 17:53:00 UTC, Adam D Ruppe wrote:
Interesting... you know, maybe D's GC should formally expose a mutex
that you can synchronize on for when it is running.
.. or compile in write barriers. then it doesn't matter if the
On 12/4/22 06:27, Sergey wrote:
> if it will be possible to write
> library in D and use it from
> C/++/Python/R/JVM(JNI)/Erlang(NIF)/nameYourChoice smoothly it will be a
> win.
Years ago we tried to call D from Java. I realized that it was very
tricky to introduce the calling thread to D's
On 12/4/22 05:58, vushu wrote:
> I was worried if my library should be GC free
May I humbly recommend you question where that thinking comes from?
Ali
P.S. I used to be certain that the idea of GC was wrong and the creators
of runtimes with GC were simpletons. In contrast, people like me,
On 12/2/22 13:18, thebluepandabear wrote:
> But I don't really understand this? What does it mean that it 'must be
> represented by at least 2 bytes'?
The integral value of Ğ in unicode is 286.
https://unicodeplus.com/U+011E
Since 'char' is 8 bits, it cannot store 286.
At first, that
On 12/2/22 13:44, rikki cattermole wrote:
> Yeah you're right, its code unit not code point.
This proves yet again how badly chosen those names are. I must look it
up every time before using one or the other.
So they are both "code"? One is a "unit" and the other is a "point"? Sheesh!
Ali
On 11/30/22 16:48, Ali Çehreli wrote:
Functions are syntax sugar. :)
And I remembered std.array.staticArray. One its overloads should be useful:
import std;
void main() {
auto v3 = staticArray!(0.1f.repeat(5));
auto v4 = staticArray!5(0.1f.repeat);
writeln(v3);
writeln(v4);
On 11/30/22 16:39, jwatson-CO-edu wrote:
Is there a way to write a single statement that creates a void pointer
that points to an initialized float array? See below:
```d
float* arr = cast(float*) new float[4];
arr[0] = 0.1;
arr[1] = 0.1;
arr[2] = 0.1;
arr[3] = 0.1;
void* value = cast(void*)
On 11/29/22 15:25, DLearner wrote:
> 'dynamic array' is
> not a reasonable description for a construct that behaves like
> VarArr2[3] becoming 40.
I agree with you: It has always bothered me to call the following a
dynamic array:
int[] arr;
'arr' is not a dynamic array but the slice
On 11/29/22 19:07, thebluepandabear wrote:
> But the book doesn't talk about why the D compiler came up with these
> results
The compiler doesn't do anything special. It's all about the lack of
bits to store the value. If the result needs 33 bits but the type has
only 32 bits, the
On 11/14/22 14:41, kdevel wrote:
> the ftw version gets the whole information from readdir alone.
Created an enhancement request:
https://issues.dlang.org/show_bug.cgi?id=23512
Ali
On 11/25/22 05:06, Victor Porton wrote:
>> A function argument that is both input and output, may be passed to
>> the function either as reference or do two assignments: on entry of
>> the function it is assigned to the parameter, on exit it is assigned
>> back.
The way I understand it with C,
On 11/20/22 14:37, [] () {} () wrote:
> so, as I understand it, your're against the use of private, against the
> use of class, and against the use of encapsulation.
I never implied any of that.
> .. good luck with your career as a software engineer (but please, for
> all our sakes, don't work
On 11/20/22 23:01, [] () {} () wrote:
> On that basis, I might be tempted to agree with you're point of view ->
> never, ever, ever, ever, use classes in D.
That's not my point of view.
Ali
On 11/20/22 00:31, [] () {} () wrote:
> Quoted from that video (the one that you agree with):
>
> "I don't ever think that private .. private is like just .. shouldn't
> even be used."
>
> "so I don't even use classes I just use struct so that everything is
> always public .. and that in my
On 11/19/22 01:43, [] () {} () wrote:
> do it your way for the next 10 years, and
> I bet you will eventually come to a different point of view ;-)
Hm... I am responding without reading the rest of the thread so I don't
know whether you've mentioned the 10 years more but here it goes: I hope
On 11/19/22 01:05, [] () {} () wrote:
> All this because some programmer wanted to save a few key strokes, or
> did not anticipate change, or did not anticipate the need to ensure data
> is valid before assigning it, or returning it.
>
> So no. It's not overkill. It's called software
On 11/18/22 20:13, [] () {} () wrote:
> after 10 years of doing all that, you may well come to the conclusion
> that public member variables are not such a great idea afterall ;-)
It depends. Majority of my structs are pure data. When there is no
invariant to protect, then there is no reason
On 11/18/22 19:35, [] () {} () wrote:
> I like to see an example, of a 'class type' with 'public' member
> variables, somehow magically converted into both getter and setter using
> UFCS, without breaking client code.
UFCS was mentioned before in the same context but I think what is meant
was
On 11/16/22 20:39, thebluepandabear wrote:
> I am debating whether or not I should add getter methods to these
> properties.
If you are debating, then the answer is easy: you should not. :)
Less code written means less bugs, more cohesion, easier refactoring,
cleaner code, all good stuff...
On 11/15/22 06:05, Siarhei Siamashka wrote:
> Ali commented that "the
> compiler cannot do anything about it in all cases and we wouldn't want
> it to spend infinite amount of time to try to determine everything".
Yes, that's my understanding.
> This sounds like he justifies the compiler's
On 11/14/22 19:05, Elfstone wrote:
> @safe
> int[] foo()
> {
> int[1024] static_array;
> // return static_array[]; // Error: returning `static_array[]`
> escapes a reference to local variable `static_array`
That is trivial for the compiler to catch.
>
On 11/11/22 08:00, Ali Çehreli wrote:
> It may have to do something with the performance of the hard disk.
I meant "the reason you got a much better improvement" may have to do
something with the performance differences of your hard disk and mine.
Ali
On 11/11/22 05:13, kdevel wrote:
> dmd -O compiled patched (see below!) version applied to /usr/bin on my
> desktop
> yields:
>
> ftw : 363 ms, 750 ÎŒs, and 5 [*]
> dirEntries: 18 secs, 831 ms, 738 ÎŒs, and 3 [*]
Great. I did not use -O with my test. It may have to do something with
the
On 11/9/22 12:06, Ali Çehreli wrote:
> I am using its sibling 'ftw'
Now that we know that dirEntries works properly, I decided not to use ftw.
However, ftw performs about twice as fast as dirEntries (despite some
common code in the implementation below). I am leaving it here in case
somebody
On 11/9/22 11:30, Vladimir Panteleev wrote:
> On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote:
>> Running the program shows no output; 'a' is not visited as a directory
>> entry.
>
> That's not what happens for me:
Does not happen for me today either. (?) I must have confused
On 11/9/22 11:05, Ali Çehreli wrote:
> Can you think of a workaround to achieve that?
Me, me, me! :) I've learned about the Posix function 'nftw' (but I am
using its sibling 'ftw').
It was pretty easy to use but there is a quality issue there: They
failed to support a 'void*' context for
On 11/9/22 11:48, Imperatorn wrote:
> That's not the behaviour I get in Windows.
Windows users deserve it! :p (At least it is better in this case. :) )
> When I create the subdirectory, I see it even if it's empty
struct DirIteratorImpl has different implementations for Windows, etc.
Ali
In case it matters, the file system is ext4.
1) Create a directory:
mkdir deleteme
and then run the following program:
import std;
void main() {
foreach (e; dirEntries(absolutePath("./deleteme"), SpanMode.breadth)) {
writeln(e.name);
}
}
Understandably, the top level
On 11/8/22 04:53, Alexander Zhirov wrote:
> On Tuesday, 8 November 2022 at 12:43:47 UTC, Adam D Ruppe wrote:
>> Just use plain `string`.
>
> So it's always working with thick pointers?
Yes, D's arrays are fat pointers. strings are arrays of immutable(char).
>> nope, an object isn't created
On 11/3/22 08:40, H. S. Teoh wrote:
> D does not have the equivalent of C++'s allocating a class instance on
> the stack.
Not by default but we have two different ways, either may be discouraged:
import std.typecons : scoped;
import std.stdio;
class C {
int i;
}
void main() {
//
On 11/3/22 03:00, Bruno Pagis wrote:
>void print() {
> writeln("array = ", this.array);
>}
Similar to Paul Backus's program but I would try to avoid the file
system for unit tests when possible. In this case, you can print into a
sink, which can be useful in other ways as well:
On 11/3/22 04:58, Paul Backus wrote:
> https://issues.dlang.org/show_bug.cgi?id=23453
Even though iterating over UTF value ranges don't make sense in general,
they would work for some values including the ASCII range.
Ali
On 11/1/22 10:27, H. S. Teoh wrote:
> Maybe try running Digger to reduce the code for you?
Did you mean dustmite, which is accessible as 'dub dustmite
' but I haven't used it.
My guess for the segmentation fault is that the OP is executing
destructor code that assumes some members are
On 10/29/22 20:41, arandomonlooker wrote:
> string exampleCTFE(string a, string b) {
> return a ~ b;
> }
Although you need that function only at compile time, it is an ordinary
function that could be called at run time as well. The function needs GC
for that concatenation in the general
On 10/26/22 14:19, Ali Çehreli wrote:
>https://dlang.org/spec/type.html#integer-promotions
Reading "Value Range Propagation" further down that link, I learned that
e.g. masking 'decimal' with 0xf makes the code compile:
return ((decimal & 0xf) + ubyte('0'));
return
On 10/26/22 14:10, 0xEAB wrote:
> I guess, this fancy behavior is inherited from C.
Yes. It is called integer promotions:
https://dlang.org/spec/type.html#integer-promotions
(The next section is related as well.)
> I know this is advanced stuff, but the compiler *could* even prove that
>
On 10/25/22 22:49, Siarhei Siamashka wrote:
> Unicode is significantly simpler than a set of various
> incompatible 8-bit encodings
Strongly agreed.
> I'm surely
> able to ignore the peculiarities of modern Turkish Unicode
The problem with Unicode is its main aim of allowing characters of
On 10/25/22 19:25, Salih Dincer wrote:
> with static in main():
If 'static' makes a difference on your side as well, it is your turn to
create a bug report. :) (Last time you discovered a bug, I was too quick
to report it. :/)
Ali
On 10/25/22 17:16, Salih Dincer wrote:
> Excuse me, but they still write in purple prose about dynamic
> array literature here!
I've heard positive things about D's arrays from people who use D in
production. Especially slices...
> I've known D for more than 10 years, but the topic we're
On 10/25/22 15:07, WhatMeWorry wrote:
> auto screen = executeShell(cmdLine);
> auto s;
That can't work because there is no information to infer the type of
's'. Judging from the return type of getPath, perhaps it's string[]:
string[] s;
This is the question we should answer first: What
On 10/25/22 13:36, matheus wrote:
> On Tuesday, 25 October 2022 at 20:12:25 UTC, Paul Backus wrote:
>> Static arrays are value types.
What that means is, when we say float[3], there are just 3 floats
without any overhead.
>> Dynamic arrays are reference types.
That phrase can be confusing
On 10/25/22 13:12, Paul Backus wrote:
> In order to create a copy of a static array
Although .dup works for static arrays as well, you meant "dynamic array"
and everyones knows it. :)
> with its own block of
> memory, separate from the original, you have to use the built-in `.dup`
> method:
On 10/25/22 11:23, Steven Schveighoffer wrote:
>> Why do I say incorrect things like that? :)
> You were right actually.
As always! Now I'm confused. :o)
Ali
On 10/25/22 11:01, Ali Çehreli wrote:
> static arrays don't have .ptr to point
> to any member.
Why do I say incorrect things like that? :) Of course static arrays have
.ptr as well but that always point to their own body of N elements. They
own their elements... I move away from the keyboard
On 10/25/22 10:54, Salih Dincer wrote:
> So I don't understand why it causes problems with
> dynamic arrays! So why is there nothing wrong with the static array in
> the example below?
The same rules as other uses of dynamic arrays...
> //A[] a = [A.init];/*
In that case, there is a
On 10/25/22 08:50, Andrey Zherikov wrote:
> I'd like to tune default ctor but structs can't have custom one.
> Adding a ctor with parameter seems a hack to me
There is static opCall, which may be seen as a hack as well. :) The
following all print the same thing now:
import std.stdio;
struct
On 10/25/22 07:53, Adam D Ruppe wrote:
> On Tuesday, 25 October 2022 at 13:51:30 UTC, Andrey Zherikov wrote:
>> A[] a = [A.init];
>
> This is a problem - this is referring to a static array instance, shared
> across all copies of B. You almost certainly don't want this.
Agreed. It should be
On 10/24/22 14:26, Per Nordlöw wrote:
What property of a container (type) `T` enables iteration as
```d
foreach (k, v; T.init)
{
...
}
```
? I thought it sufficed to define `T.byKeyValue` but its presence seem
to have no effect.
Another option is to use range functions where front()
On 10/22/22 08:21, Kevin Bailey wrote:
> his claim that there was no value.
I think he was questioning the need for iterating from a point forward
inside an unordered container. When the container is unordered, the
elements that are accessed after a found element could be anything. I
think
On 10/22/22 14:53, WhatMeWorry wrote:
>
>
> string[] tokens = userSID.output.split!isWhite;
> writeln("tokens = ", tokens);
Could you please show minimal compilable code that demonstrates the
issue. I spent some time with some guesses but failed (to get my code to
compile with
On 10/21/22 15:03, Kevin Bailey wrote:
I'm trying to do this equivalent C++:
unordered_map map;
for (auto i = map.find(something); i != map.end(); ++i)
...do something with i...
in D, but obviously with an associative array. It seems that it's quite
easy to iterate through
On 10/19/22 09:47, data pulverizer wrote:
> It's okay, I've found a work around.
Do you simply check the return value?
Ali
On 10/19/22 07:05, data pulverizer wrote:
> I am calling code from a C API, and would like to know how to catch exit
> errors
If you are talking about the exit() Posix function, you can't do
anything about that because its purpose is to cause "normal process
termination".
Ali
On 10/18/22 12:26, Hipreme wrote:
> Is there any way to know which files produced this error or at least the
> symbol names that are clashing? I'm totally helpless about this error.
There is 'nm' on Posix systems that lists symbols in object files
(including libraries and programs).
Ali
On 10/18/22 06:24, Guillaume Piolat wrote:
> To win something with OS threads, you must think of tasks that takes on
> the order of milliseconds rather than less than 0.1ms.
> Else you will just pay extra in synchronization costs.
In other words, the OP can adjust work unit size. It is on the
On 10/17/22 22:40, Joel wrote:
> I have two text fields. The one on the left has the whole text, new
> stuff being added to the bottom. The one on the right has text I've been
> wiping as I'm reading.
I think this can be modelled as a string array and an index showing
where the active part
Changing the order of lines...
On 10/13/22 16:43, WhatMeWorry wrote:
> return s.split(';'); // single quotes
That one is a single character and very lightweigth because it's just an
integral value. You can't put more than one character within single quotes:
';x' // ERROR
> return
On 10/5/22 13:40, torhu wrote:
auto sw = StopWatch();
Either this:
auto sw = StopWatch(AutoStart.yes);
or this:
auto sw = StopWatch();
sw.start();
Ali
On 10/4/22 10:59, Riccardo M wrote:
> The inherent reason for `remove` to cancel previous capacity and
> requiring new allocations is exactly to prevent overwriting data that
> could be owned by something else?
Yes.
A related topic is how the "end slice" never loses that capacity:
void main()
On 10/3/22 17:00, Paul Backus wrote:
> On Monday, 3 October 2022 at 21:06:36 UTC, Ali Çehreli wrote:
>> On 10/3/22 13:48, Andrey Zherikov wrote:
>>> a "rotated view".
>>
>> Without indexes:
>>
>> import std.range : empty;
>>
>> auto rotatedView(R)(R range)
>> in (!range.empty)
>> {
>> import
On 10/3/22 13:48, Andrey Zherikov wrote:
a "rotated view".
Without indexes:
import std.range : empty;
auto rotatedView(R)(R range)
in (!range.empty)
{
import std.range : chain, front, only, popFront;
const fr = range.front;
range.popFront();
return chain(range, only(fr));
}
On 10/2/22 10:55, data pulverizer wrote:
> On Sunday, 2 October 2022 at 17:28:51 UTC, data pulverizer wrote:
>> Sorry I'll need to implement all the overloaded copy constructors and
>> see if that fixes it.
>
> I've got it, something weird happened to my copy constructor. This was
> my original
On 10/2/22 10:28, data pulverizer wrote:
> On Sunday, 2 October 2022 at 17:19:55 UTC, data pulverizer wrote:
>> Any reason why this could be?
>
What I noticed first in your original code was that it would be
considered buggy because it was not considering copying. Every struct
that does
On 10/1/22 11:15, Kyle Ingraham wrote:
> storing structs as
> `void*` in a wrapper struct with information about their module and
> identifier saved elsewhere.
Perhaps unrelated but that part reminded me of the following discussion:
On 9/30/22 14:11, solidstate1991 wrote:
> extern (C) public int registerDDelegate(alias Func,
That can be a lambda that takes ClassType. I wrote the following along
with place holder as I assumed them to be:
class C {
string s;
void foo() {
import std.stdio : writeln;
On 9/29/22 01:28, Riccardo M wrote:
> if one should
> slightly rearrange C++ code as well.
Right. Additionally, the order of members must match (I am pretty sure,
which means I am not :p).
> I am a recent addition to D
> language :)
Welcome! :)
> Do you know that this is documented
101 - 200 of 2532 matches
Mail list logo