On Saturday, 5 July 2025 at 08:08:08 UTC, Jonathan M Davis wrote:
On Friday, July 4, 2025 12:04:55 PM Mountain Daylight Time
partypooper via Digitalmars-d-learn wrote:
[...]
The only time that a setter function would be triggered would
be assignment such as
[...]
Thanks for your thorough
On Friday, 4 July 2025 at 18:04:55 UTC, partypooper wrote:
It doesn't work. Or it works even worse: changing _pos, but not
_dest. What is going on is that on `+=` it for some reason
invokes "getter", not "setter". I specifically omitted "ref",
because I already have known of that behavior.
In
On Friday, 4 July 2025 at 17:34:59 UTC, monkyyy wrote:
On Friday, 4 July 2025 at 17:15:48 UTC, partypooper wrote:
if you add ref to line 28 it works; there wont be a reasonable
way to make an error happen, you just have to know when to do
refness
It doesn't work. Or it works even worse: chang
```d
struct Vector
{
float x, y;
Vector opBinary(string op)(inout Vector rhs) const if (op ==
"+")
{
return Vector(mixin("x", op, "rhs.x"), mixin("y", op,
"rhs.y"),);
}
ref Vector opOpAssign(string op)(inout Vector rhs) if (op ==
"+" || op == "-")
{
On Monday, 21 February 2022 at 11:21:52 UTC, Mike Parker wrote:
On Monday, 21 February 2022 at 11:07:55 UTC, Basile B. wrote:
[...]
This has nothing to do with which exceptions types a function
throws. The compiler doesn't dig into that. You have to catch
`Exception`.
```D
import std.stdio
On Monday, 21 February 2022 at 11:07:55 UTC, Basile B. wrote:
Yeah there must be another one then. Something actionnable is
the documentation.
What about Mike Parker answer?
On Monday, 21 February 2022 at 11:04:46 UTC, Mike Parker wrote:
On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote:
Do I completely not understand what is `nothrow` or why I
can't make function nothrow with just catching StdioException?
D does not have checked exceptions like Java,
On Monday, 21 February 2022 at 10:58:26 UTC, Basile B. wrote:
more likely UTFException actually
Additionaly catching UTF and Conv exceptions doesn't help.
Do I completely not understand what is `nothrow` or why I can't
make function nothrow with just catching StdioException?
This doesn't work
```d
nothrow void hello() {
try {
writeln("Hello, World!")
} catch (StdioException) {}
}
```
This doest work
```d
nothrow void hello() {
try {
On Monday, 21 February 2022 at 10:04:16 UTC, steve wrote:
I am trying to implement a simple map function. I found code to
do this in another post but it only seems to work with lambda
functions and I do not understand why. Any help would be
greatly appreciated
```
import std.stdio;
T[] map_v
On Sunday, 20 February 2022 at 17:02:21 UTC, H. S. Teoh wrote:
The D convention is to append a `_` to the identifier. From
https://dlang.org/dstyle.html:
But this doesn't fix the issue, because mir-ion will throw an
exception that there is no version_ field that required and but
json strin
On Sunday, 20 February 2022 at 15:33:17 UTC, Andrey Zherikov
wrote:
On Sunday, 20 February 2022 at 11:08:55 UTC, partypooper wrote:
keyword as struct field
I believe this is the case for the most languages - keyword is
not allowed as a variable name.
Yes, but as example in Nim you can surro
On Sunday, 20 February 2022 at 14:00:45 UTC, Basile B. wrote:
I have a library solution based on opDispatch +
__traits(getMember):
Thank you, didn't know about opDispatch, so you have taught me
something new today.
But seems for my current need it can't be apllied (or I still
don't understan
Hello, I'm new to D.
Title is self described, is it possible to use keyword as struct
field?
Maybe it is XYproblem, so here I will describe a little what I
need.
I'm parsing some json currently with
[mir-ion](https://code.dlang.org/packages/mir-ion)
(better/simpler suggestions for only json
14 matches
Mail list logo