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;
> > >
> > > [...]
> >
> > It's seeing the
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', it states: "If the
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
27 matches
Mail list logo