On Wednesday, 10 September 2025 at 20:23:28 UTC, monkyyy wrote:
I asked
does a preexisting nd array iterator exist?
got links to mir, docs I can barely read (srsly math language
is anticomprehension)
ndslice allocates, so, hottake misnamed. A slice is a reference
to an array, a dynmaic arr
On Sunday, 14 September 2025 at 02:50:42 UTC, Jonathan M Davis
wrote:
Memory gets weird on top of that because of the desire to use
the GC with pure functions and the argument that two objects
with the same value are the same even though they're different
places in memory (so whether they're re
On Friday, September 12, 2025 3:48:49 AM Mountain Daylight Time IchorDev via
Digitalmars-d-learn wrote:
> Recently I wanted to write a pure function that returns an
> unpredictable number, so I decided to use RDTSC (and any
> equivalent instruction for other CPU architectures) to do this
On Friday, September 12, 2025 9:20:38 AM Mountain Daylight Time Brother Bill
via Digitalmars-d-learn wrote:
> Is is possible to 'disable' .init for a struct?
Technically, yes, but you should absolutely never do it, and it will likely
become illegal to do so at some point in the fut
On Friday, September 12, 2025 5:58:57 PM Mountain Daylight Time Brother Bill
via Digitalmars-d-learn wrote:
> Is it time to consider D 3.x.x, that takes the best of D,
> discards the mistakes, the mud and the hair, so most well written
> D 2.x.x programs still work?
Unless, something si
On Friday, September 12, 2025 6:43:38 PM Mountain Daylight Time Brother Bill
via Digitalmars-d-learn wrote:
> I'm not clear about why 'class'es are on the 'avoid' list.
It's more that there's rarely any reason to use classes in D for the average
program. If
On Saturday, 13 September 2025 at 15:26:15 UTC, H. S. Teoh wrote:
On Sat, Sep 13, 2025 at 12:43:38AM +, Brother Bill via
Digitalmars-d-learn wrote:
[...]
Whose avoid list?
[...]
what are those real profiles that you're using now?
On Monday, 8 September 2025 at 20:10:52 UTC, Sergey wrote:
On Monday, 8 September 2025 at 19:55:20 UTC, Neto wrote:
Why isn't D production ready?
One has to ask why to choose a production language.
1. First one has to be aware that it exists.
a. See Eiffel and D
Eiffel has been in prod
On Thursday, 11 September 2025 at 09:51:55 UTC, Mikhail wrote:
I don't understand what I should do? Define global variables as
shared?
Andrea Fontana reply more good than my.
But I hope you read article for new knowledges.
Anyway, IMHO, if you want use global variable from two ore more
thread
On Friday, 12 September 2025 at 15:24:46 UTC, Monkyyy wrote:
On Friday, 12 September 2025 at 15:20:38 UTC, Brother Bill
wrote:
Is is possible to 'disable' .init for a struct?
No (and honestly it's bad style to break the constructors)
Please expound on why its 'bad style' to disable construct
On Friday, 12 September 2025 at 21:46:51 UTC, monkyyy wrote:
On Friday, 12 September 2025 at 20:10:25 UTC, H. S. Teoh wrote:
Phobos code was legendary for being a standard library that
didn't make your head hurt when you read it. (If you've ever
tried reading the source code for Glibc, or the s
I'm not clear about why 'class'es are on the 'avoid' list.
D has excellent support for Single inheritance, Interfaces,
Design by Contract (DbC), GC, etc.
I'm aware that there is a small run time cost for selecting the
right virtual method.
To reduce this cost, one must final-ize methods that
On Friday, 12 September 2025 at 23:58:57 UTC, Brother Bill wrote:
On Friday, 12 September 2025 at 21:46:51 UTC, monkyyy wrote:
On Friday, 12 September 2025 at 20:10:25 UTC, H. S. Teoh wrote:
Phobos code was legendary for being a standard library that
didn't make your head hurt when you read it.
On Saturday, 13 September 2025 at 00:43:38 UTC, Brother Bill
wrote:
I'm not clear about why 'class'es are on the 'avoid' list.
D has excellent support for Single inheritance, Interfaces,
Design by Contract (DbC), GC, etc.
I'm aware that there is a small run time cost for selecting the
right vi
On Friday, 12 September 2025 at 20:10:25 UTC, H. S. Teoh wrote:
Phobos code was legendary for being a standard library that
didn't make your head hurt when you read it. (If you've ever
tried reading the source code for Glibc, or the standard
library for almost any other language, really, you'll
Is is possible to 'disable' .init for a struct?
source/app.d
```
import std.stdio;
void main()
{
// Can still create Archive with an empty filename. We can't
have that.
auto noDefault = Archive.init;
writefln("fileName: [%s]", noDefault.fileName);
}
// adding a constructor au
On Fri, Sep 12, 2025 at 03:41:15PM +, realhet via Digitalmars-d-learn wrote:
> On Friday, 12 September 2025 at 15:28:58 UTC, Monkyyy wrote:
> > On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
> > > Hi,
> > >
> > > ```d
> > > import std
On Fri, Sep 12, 2025 at 06:19:46PM +, Brother Bill via Digitalmars-d-learn
wrote:
[...]
> As a newbie to D, really trying to understand it, I am merely trying
> to uncover how to effectively use D. When Programming in D book, page
> 292, section 52.4 talks about 'postblit
On Friday, 12 September 2025 at 18:19:46 UTC, Brother Bill wrote:
Is there a 'style' guide for D, such as: Do this, Don't do
that, avoid this, etc.?
Someone will link the "offical" style guide, but thats nothing id
follow
"There are these features in the language, but you should avoid
the
On Friday, 12 September 2025 at 15:38:15 UTC, Monkyyy wrote:
On Friday, 12 September 2025 at 15:31:37 UTC, Brother Bill
wrote:
On Friday, 12 September 2025 at 15:24:46 UTC, Monkyyy wrote:
On Friday, 12 September 2025 at 15:20:38 UTC, Brother Bill
wrote:
Is is possible to 'disable' .init for a
On Friday, 12 September 2025 at 13:27:53 UTC, realhet wrote:
(x); <- Is not a construct that comes to my mind as useful,
but this was it. This forces the mixin to expect an expression
and not a statement.
Thanks for sharing it! - I did not know this works. :)
On Friday, 12 September 2025 at 12:23:21 UTC, Nick Treleaven
wrote:
On Friday, 12 September 2025 at 09:17:10 UTC, realhet wrote:
On Friday, 12 September 2025 at 08:44:47 UTC, Stefan Koch
wrote:
On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
I did a complete 'martix' of these com
On Friday, 12 September 2025 at 09:55:01 UTC, IchorDev wrote:
On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
Is this a feature or a bug? :D
You will have to start writing much weirder code than this to
Yea, I don't think I dare to do such crazy things, like an lambda
in an UDA
On Friday, 12 September 2025 at 15:28:58 UTC, Monkyyy wrote:
On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
Hi,
```d
import std;
[...]
It's seeing the eof of the mix file no?
This is the smallest example so far:
```d
import std;
void main() {
( mixin("(()=>1)()") ); //i
On Friday, 12 September 2025 at 15:31:37 UTC, Brother Bill wrote:
On Friday, 12 September 2025 at 15:24:46 UTC, Monkyyy wrote:
On Friday, 12 September 2025 at 15:20:38 UTC, Brother Bill
wrote:
Is is possible to 'disable' .init for a struct?
No (and honestly it's bad style to break the constru
On Friday, 12 September 2025 at 14:48:43 UTC, Kagamin wrote:
malloc is weakly pure, because it returns mutable pointer. The
difference is when you call it from strongly pure function,
then it doesn't matter, how many times malloc was called.
And if the compiler tries to memoise it?
On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
Hi,
```d
import std;
[...]
It's seeing the eof of the mix file no?
malloc is weakly pure, because it returns mutable pointer. The
difference is when you call it from strongly pure function, then
it doesn't matter, how many times malloc was called.
On Friday, 12 September 2025 at 09:17:10 UTC, realhet wrote:
On Friday, 12 September 2025 at 08:44:47 UTC, Stefan Koch wrote:
On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
Hi, thanks for quick answer!
When I turn the string mixin into a statement by putting a `;`
at its end, th
On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
Is this a feature or a bug? :D
You will have to start writing much weirder code than this to
find compiler bugs in D because when a bug is fixed, a new test
is created to make sure it doesn't regress. Surface-level
features are usu
On Thursday, 11 September 2025 at 08:06:17 UTC, IchorDev wrote:
But that's the thing: all I want is to construct objects into
*freshly-allocated*, *uninitialised memory*; so my desired
use-case has a safe interface and can therefore be marked
`@trusted`. However the constructor is a wildcard, s
Recently I wanted to write a pure function that returns an
unpredictable number, so I decided to use RDTSC (and any
equivalent instruction for other CPU architectures) to do this,
since the compiler allows RDTSC to be marked as `pure`.
However, in the end I discarded this idea because I figured
On Thursday, 11 September 2025 at 17:16:35 UTC, Paul Backus wrote:
```d
void inferSystem() @system pure nothrow @nogc {}
T* example(T)() {
static if (!isSafe!(() { new T(); })
inferSystem();
return (() @trusted => new (new void[](T.sizeof)) T())();
}
```
Unfortunately that woul
On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
Is this a feature or a bug? :D
Is there a way to make this processing_and_optional_returning
thing better?
It is a bug in your code.
Change line 6 to
```d
(){ val += 1; return val; }();
```
After the added `;` it should wo
On Friday, 12 September 2025 at 08:44:47 UTC, Stefan Koch wrote:
On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
Hi, thanks for quick answer!
When I turn the string mixin into a statement by putting a `;` at
its end, the
enum bla = `(){return 4;}();`
`mixin(bla);` Case works p
On Friday, 12 September 2025 at 08:36:42 UTC, realhet wrote:
Hi,
```d
import std;
void main() {
int val = 4;
enum prog = q{
(){ val += 1; return val; }()
};
//mixin(prog); //
auto dummy = mixin(prog); //Must capture the return value,
otherwise it hallucinates EOF.
Hi,
```d
import std;
void main() {
int val = 4;
enum prog = q{
(){ val += 1; return val; }()
};
//mixin(prog); //
auto dummy = mixin(prog); //Must capture the return value,
otherwise it hallucinates EOF.
writeln(val);
}
```
When uncommentingmixin(prog);
It
On 11/09/2025 12:29 AM, IchorDev wrote:
I thought the 'placement new' feature might replace my need for
`emplace`, but I don't see a way to mark a placement new as `@trusted`
without marking the call to the object's constructor as `@trusted` also?
```d
void main() @safe{
X x;
//pla
https://tour.dlang.org/tour/en/gems/opdispatch-opapply
This states: "Any unknown member function call to that type is
passed to opDispatch, passing the unknown member function's name
as a string template parameter."
So I tried that. But the compiler didn't like it.
How should I play the game
On Tuesday, 9 September 2025 at 11:57:54 UTC, Brother Bill wrote:
On Tuesday, 9 September 2025 at 01:24:59 UTC, monkyyy wrote:
```
// I suggest a habit of avoiding simple names when generating
mixin code
```
Please provide an example where providing simple names causes
'trouble'.
```d
im
On Tuesday, 9 September 2025 at 21:08:59 UTC, drug007 wrote:
On 09.09.2025 01:53, Kapendev wrote:
On Monday, 8 September 2025 at 21:25:25 UTC, drug007 wrote:
On 08.09.2025 22:55, Neto wrote:
On Monday, 8 September 2025 at 16:51:09 UTC, Serg Gini wrote:
And not sure if ecosystem was a signifi
On Wed, Sep 10, 2025 at 05:15:16PM +, monkyyy via Digitalmars-d-learn wrote:
[...]
> I just do always enum; going all in on compile time abstractions
Be careful, this may not always be what you want. For example:
```d
enum data = [ 1, 2, 3 ];
void main() {
auto buffer = d
On Tuesday, 9 September 2025 at 20:56:19 UTC, Steven
Schveighoffer wrote:
On Tuesday, 9 September 2025 at 20:08:06 UTC, monkyyy wrote:
On Tuesday, 9 September 2025 at 19:17:11 UTC, Steven
Schveighoffer wrote:
In short `opDispatch` only is valid if it compiles. If it
doesn't compile, it's as i
On Wednesday, 10 September 2025 at 03:46:37 UTC, felixfxu wrote:
On Monday, 8 September 2025 at 20:10:52 UTC, Sergey wrote:
being focused on required important tasks = complicated
I don't quite understand the item above. What's dlang's
`"required important tasks"` now?
This one actually ove
On Wednesday, 10 September 2025 at 12:29:24 UTC, IchorDev wrote:
If anyone has any ideas, please let me know.
The trick that's used in druntime is putting the part that still
needs to be checked for attributes inside an `if (false)` block,
for example:
https://github.com/dlang/dmd/blob/c817
On Thursday, 11 September 2025 at 09:51:55 UTC, Mikhail wrote:
On Thursday, 11 September 2025 at 09:40:22 UTC, novicetoo wrote:
cond and mutex are global variables,
and "Starting with dmd version 2.030, the default storage
class for statics and globals will be thread local storage
(TLS)"
http
On Thursday, 11 September 2025 at 09:40:22 UTC, novicetoo wrote:
cond and mutex are global variables,
and "Starting with dmd version 2.030, the default storage class
for statics and globals will be thread local storage (TLS)"
https://dlang.org/articles/migrate-to-shared.html
I don't understan
On Thursday, 11 September 2025 at 09:29:29 UTC, Mikhail wrote:
I wrote simple example to learn how the work Conditions.
But program closed with signal, what's wrong?
import std.stdio;
import core.thread;
import core.sync.condition;
import core.sync.mutex;
Condition cond;
Mutex mutex;
void thr
I wrote simple example to learn how the work Conditions.
But program closed with signal, what's wrong?
import std.stdio;
import core.thread;
import core.sync.condition;
import core.sync.mutex;
Condition cond;
Mutex mutex;
void threadFunction()
{
writeln("This is running in a separate threa
On Wednesday, 10 September 2025 at 17:33:48 UTC, H. S. Teoh wrote:
`enum` defines a compile-time constant. It occupies no space,
and its value is "copied" into every expression in which it
appears.
[...]
`const` and `immutable` are type qualifiers, and declaring a
constant with them creates a
On Thursday, 11 September 2025 at 03:47:02 UTC, Richard (Rikki)
Andrew Cattermole wrote:
It did go through the DIP process.
Blast, you're right. I've even seen the DIP Development post for
it before, too! I didn't read into it at the time. I could've
probably identified this problem and raise
On Thursday, 11 September 2025 at 04:19:02 UTC, Paul Backus wrote:
The problem is not really with placement new, it's with
constructors. Constructors are allowed to mutate immutable
objects (under the assumption that they are initializing a
newly-created object). If you call a constructor twice
On 11/09/2025 3:27 AM, IchorDev wrote:
On Wednesday, 10 September 2025 at 14:45:52 UTC, Richard (Rikki) Andrew
Cattermole wrote:
The caller is responsible for guaranteeing that the memory passed in
is uninitialized, and that behavior is @system.
Yeah but I should be able to mark it as `@truste
On Wednesday, 10 September 2025 at 14:31:27 UTC, IchorDev wrote:
On Wednesday, 10 September 2025 at 13:13:34 UTC, Richard
(Rikki) Andrew Cattermole wrote:
Placement new is @system, but you wanted to use it in an @safe
function iff the constructor to be called is @safe as well.
Pretty much.
Th
On Wed, Sep 10, 2025 at 04:52:51PM +, Brother Bill via Digitalmars-d-learn
wrote:
> Is there any reason to pick one of these vs. another one, or are they
> all equivalent?
[...]
They are most definitely not equivalent.
`enum` defines a compile-time constant. It occupies no space, a
I asked
does a preexisting nd array iterator exist?
got links to mir, docs I can barely read (srsly math language is
anticomprehension)
ndslice allocates, so, hottake misnamed. A slice is a reference
to an array, a dynmaic array is a gc allocated array
https://opendlang.org/library/mir.nds
On Wednesday, 10 September 2025 at 16:52:51 UTC, Brother Bill
wrote:
Is there any reason to pick one of these vs. another one, or
are they all equivalent?
If equivalent, it would seem that immutable appears to be the
'strongest', whereas enum has fewer keystrokes.
Is there a D 'best practice
On 11/09/2025 2:31 AM, IchorDev wrote:
On Wednesday, 10 September 2025 at 13:13:34 UTC, Richard (Rikki) Andrew
Cattermole wrote:
The reason placement new is @system is because of double-init. It
can't be a safe operation.
What?! Like, it assigns to the memory twice? What's the point of this
f
On Wednesday, 10 September 2025 at 14:01:29 UTC, Brother Bill
wrote:
Page 119 of Programming in D
It seems odd that == null and is null have different values?
Is this a bug or feature?
If a feature, what is the meanings of == null vs. is null?
Feature. An AA has reference semantics. Removing a
On Wednesday, 10 September 2025 at 14:01:29 UTC, Brother Bill
wrote:
what is the meanings of == null vs. is null?
You have already asked this question [here
before](https://forum.dlang.org/thread/nvaiwzvcrahnwzior...@forum.dlang.org). The spec outlines the meaning of equality and identity expr
On Wednesday, 10 September 2025 at 12:41:22 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Your calling a @system function (constructor) from a safe
function (main).
Placement new doesn't change the rules around this.
You don't understand: I *WANT* the code *FAIL* to compile because
`S`'s con
I thought the 'placement new' feature might replace my need for
`emplace`, but I don't see a way to mark a placement new as
`@trusted` without marking the call to the object's constructor
as `@trusted` also?
```d
void main() @safe{
X x;
//placement new is @system, so we have to
On Monday, 8 September 2025 at 20:10:52 UTC, Sergey wrote:
being focused on required important tasks = complicated
I don't quite understand the item above. What's dlang's
`"required important tasks"` now?
On Tuesday, 9 September 2025 at 00:45:00 UTC, monkyyy wrote:
On Tuesday, 9 September 2025 at 00:40:31 UTC, Brother Bill
wrote:
https://tour.dlang.org/tour/en/gems/opdispatch-opapply
This states: "Any unknown member function call to that type is
passed to opDispatch, passing the unknown member
On 09.09.2025 01:53, Kapendev wrote:
On Monday, 8 September 2025 at 21:25:25 UTC, drug007 wrote:
On 08.09.2025 22:55, Neto wrote:
On Monday, 8 September 2025 at 16:51:09 UTC, Serg Gini wrote:
And not sure if ecosystem was a significant weight in the decision.
Why isn't D production ready?
On Tuesday, 9 September 2025 at 20:08:06 UTC, monkyyy wrote:
On Tuesday, 9 September 2025 at 19:17:11 UTC, Steven
Schveighoffer wrote:
In short `opDispatch` only is valid if it compiles. If it
doesn't compile, it's as if it doesn't exist.
Yours still thinking declaratively, that cant be true
On Tuesday, 9 September 2025 at 19:17:11 UTC, Steven
Schveighoffer wrote:
In short `opDispatch` only is valid if it compiles. If it
doesn't compile, it's as if it doesn't exist.
Yours still thinking declaratively, that cant be true. The best
description of its behavior is that it discards er
On Tuesday, 9 September 2025 at 00:40:31 UTC, Brother Bill wrote:
```
c:\dev\D\D_templates_tutorial\toy1\source\app.d(8): Error: no
property `callHome` for `l` of type `app.CallLogger!(C)`
l.callHome("foo", "bar");
^
```
You might be expecting `opDispatch` inside `CallLogger` to try
On Tuesday, 9 September 2025 at 12:04:07 UTC, Brother Bill wrote:
When commenting out the callHome() in struct C, it fails.
You can't call a function that doesn't exist. When the function
doesn't exist, you can't call it.
Obviously if callHome() is explicitly created, it works.
*Explicitl
On Tuesday, 9 September 2025 at 09:59:40 UTC, Dejan Lekic wrote:
Hopefully this slightly modified, and commented version of your
original code will
help you understand why your mixin is failing:
```d
import std.stdio;
void main() {
CallLogger!C l;
l.callA(1, 2);
l.callB("ABC");
On Tuesday, 9 September 2025 at 01:24:59 UTC, monkyyy wrote:
```d
import std;
struct Vector(int N,T,string fields){
static foreach(I;0..N){
mixin("T "~fields[I]~";");
}
auto opDispatch(string __s__)(){//I suggest a habit of
avoiding simple names when generating
On Tuesday, 9 September 2025 at 00:40:31 UTC, Brother Bill wrote:
https://tour.dlang.org/tour/en/gems/opdispatch-opapply
This states: "Any unknown member function call to that type is
passed to opDispatch, passing the unknown member function's
name as a string template parameter."
So I tried
On Tuesday, 9 September 2025 at 01:08:41 UTC, Brother Bill wrote:
On Tuesday, 9 September 2025 at 00:45:00 UTC, monkyyy wrote:
On Tuesday, 9 September 2025 at 00:40:31 UTC, Brother Bill
wrote:
https://tour.dlang.org/tour/en/gems/opdispatch-opapply
This states: "Any unknown member function call
On Monday, 8 September 2025 at 16:51:09 UTC, Serg Gini wrote:
On Monday, 8 September 2025 at 16:43:10 UTC, Neto wrote:
[...]
It is an old news now.
They decided to use Go, because it was closer to the language
of their initial implementation (TypeScript).
D is expensive for production in mo
On Monday, 8 September 2025 at 21:25:25 UTC, drug007 wrote:
On 08.09.2025 22:55, Neto wrote:
On Monday, 8 September 2025 at 16:51:09 UTC, Serg Gini wrote:
And not sure if ecosystem was a significant weight in the
decision.
Why isn't D production ready?
I've been trying to figure it out fo
On Monday, 8 September 2025 at 16:23:23 UTC, Brother Bill wrote:
On Monday, 8 September 2025 at 14:42:01 UTC, evilrat wrote:
probably because you have declared nested function `add`
inside `main`, this creates a delegate closure capturing
`main` scope, if you don't want that just mark `add` s
On 9/8/25 9:51 AM, Serg Gini wrote:
> So I don't think they were considering D at all. Most probably they had
> some short-list of the language that their team knows and that are
> suitable for the task.
In my experience, such project "decisions" are rationalizations after
the fact. Like in mos
On Monday, 8 September 2025 at 19:55:20 UTC, Neto wrote:
Why isn't D production ready?
For this type of questions is kinda hard to prepare a short
answer..
So instead of direct answer consider to check this equation:
Being production ready is a hard/complicated target..
large language = co
On Monday, 8 September 2025 at 16:43:10 UTC, Neto wrote:
this is the reasoning
https://github.com/microsoft/typescript-go/discussions/411
I wonder if they did consider D language. First comment says
why Rust would be a good choice "If not C#, I would have
expected Rust, since that's where the
On Monday, 8 September 2025 at 16:43:10 UTC, Neto wrote:
this is the reasoning
https://github.com/microsoft/typescript-go/discussions/411
I wonder if they did consider D language. First comment says
why Rust would be a good choice "If not C#, I would have
expected Rust, since that's where the
On Monday, 8 September 2025 at 14:42:01 UTC, evilrat wrote:
probably because you have declared nested function `add` inside
`main`, this creates a delegate closure capturing `main` scope,
if you don't want that just mark `add` static.
Yep, as a nested function, this is a delegate, not a func
this is the reasoning
https://github.com/microsoft/typescript-go/discussions/411
I wonder if they did consider D language. First comment says why
Rust would be a good choice "If not C#, I would have expected
Rust, since that's where the rest of the ecosystem is. So,
another surprise there." i
It works by making doSomething as a delegate.
On Monday, 8 September 2025 at 14:42:01 UTC, evilrat wrote:
probably because you have declared nested function `add` inside
`main`, this creates a delegate closure capturing `main` scope,
if you don't want that just mark `add` static.
Marking add static works.
Still don't understand why thi
https://tour.dlang.org/tour/en/basics/delegates
This is so simple. What is D complaining about?
Should this also work with a Template, as shown?
```
import std.stdio;
void main()
{
// auto add(T)(T lhs, T rhs)
// {
// return lhs + rhs;
// }
int add
On Sunday, 7 September 2025 at 12:53:58 UTC, Brother Bill wrote:
Two assert statements on lines 43 and 44 fail.
Should these assert statements be correct, and if so, what
changes to make them correct.
Or are they incorrect, and should be removed?
Or have I made a mistake in implementing this e
Two assert statements on lines 43 and 44 fail.
Should these assert statements be correct, and if so, what
changes to make them correct.
Or are they incorrect, and should be removed?
Or have I made a mistake in implementing this exercise solution?
Console output
```
areas:[TriangularArea (1, 2)
On Wed, Sep 03, 2025 at 07:56:03PM +, Brother Bill via Digitalmars-d-learn
wrote:
> It appears that D has multiple ways of determining which created
> objects are subject to GC.
No. The GC knows which memory address ranges it manages, and any
pointer that fall outside of those range
On Wednesday, 3 September 2025 at 23:05:45 UTC, H. S. Teoh wrote:
On Wed, Sep 03, 2025 at 07:56:03PM +, Brother Bill via
Digitalmars-d-learn wrote:
[...]
C, C++ and D can play shenanigans with pointers, such as
casting them to size_t, which hides them from the GC.
D's current
It appears that D has multiple ways of determining which created
objects are subject to GC.
For class instances, new creates a new class instance, returning
a pointer to it. While "alive", other pointers may also point to
the class instance. Once no pointers are pointing to this class
insta
On 9/3/25 5:10 AM, Brother Bill wrote:
> Made some further changes, and have additional questions.
One of your question involves object aligment, which I mention here:
https://ddili.org/ders/d.en/memory.html#ix_memory..alignof
I discovered two (somewhat cryptic) functions there that computes
On Wednesday, 3 September 2025 at 03:09:45 UTC, Ali Çehreli wrote:
GC.calloc(bytesNeeded);
Again, I misled you there.
> writeln("myClasses address: ", myClasses);
>
> alias MyClassPtr = MyClass *;
That's not useful because the type MyClass is already a
reference type, implemented as
On Mon, Sep 01, 2025 at 09:28:29PM +, Andy Valencia via Digitalmars-d-learn
wrote:
> On Monday, 1 September 2025 at 16:26:15 UTC, H. S. Teoh wrote:
>
> > OOP is useful for certain classes (ha) of problems, but not all, as
> > the OOP proponents would like you to believe
On Monday, 1 September 2025 at 12:20:02 UTC, Kapendev wrote:
Insane way to do things:
```d
struct Matrix(R, C, T, bool canFly, bool isCute) if
((isNumberType!T || isMathType!T) && isGoodType!T &&
isMagicType!T) {
static if (canFly) {
this(Blah blah) {
// Blah blah...
On 8/31/25 3:52 AM, Steven Schveighoffer wrote:
> From the book:
>
>> Note: This feature is not supported by dmd 2.098.1.
What I meant there was "not yet; maybe in the future."
> Which is why I recommend removing the whole discussion.
Fair.
> If you want to ensure some order of locking you n
On Monday, 1 September 2025 at 16:26:15 UTC, H. S. Teoh wrote:
OOP is useful for certain classes (ha) of problems, but not
all, as the OOP proponents would like you to believe. Some
classes of problems are better solved with other means.
Do note that I had to bite the bullet and write an OO
On Friday, 29 August 2025 at 18:44:00 UTC, Lance Bachmeier wrote:
Classic D code includes types like Matrix!double when you could
just use DoubleMatrix.
They're like macros in Lisp. Powerful in principle but
routinely a PITA when you actually use them.
Sane way to do things:
```d
struct Mat
I have heard that there are better or at least alternative ways
to have encapsulation, polymorphism and inheritance outside of
OOP.
With OOP in D, we have full support for Single Inheritance,
including for Design by Contract (excluding 'old'). D also
supports multiple Interfaces.
What woul
On Monday, 1 September 2025 at 13:37:11 UTC, user1234 wrote:
On Monday, 1 September 2025 at 12:20:02 UTC, Kapendev wrote:
Insane way to do things:
```d
struct Matrix(R, C, T, bool canFly, bool isCute) if
((isNumberType!T || isMathType!T) && isGoodType!T &&
isMagicType!T) {
static if (can
Hi,
I'm testing dlang in ubuntu with vscode and some extensions, I
can debug a valid executable with codelldb and set breakpoints in
the d code.
Then I realized that the unittest executable file is also
generated in the work folder after I run "dub test -b debug".
Then I would like to debug
1 - 100 of 2418 matches
Mail list logo