Hi,
https://run.dlang.io/is/9afmT1
```
void main()
{
import std.csv;
import std.stdio: write, writeln, writef, writefln;
import std.algorithm.comparison : equal;
string text = "Hello;65;;\nWorld;123;7.5";
struct Layout
{
string name;
int value;
On Monday, 5 June 2023 at 18:54:30 UTC, cc wrote:
On Monday, 5 June 2023 at 13:57:20 UTC, Ki Rill wrote:
How do I generate `setX` methods for all private mutable
variables in my class? Do I need to use `__traits`?
```d
mixin template GenerateSetters() {
static foreach (idx, field;
On Monday, 5 June 2023 at 10:43:27 UTC, Ferhat Kurtulmuş wrote:
On Monday, 5 June 2023 at 10:01:01 UTC, John Xu wrote:
The parseDOM returns a DOMEntity(R) type, how do I write a
xmlRoot as global variable?
I need its detailed type (auto / Variant doesn't work).
import dxml.dom;
On Monday, 5 June 2023 at 13:57:20 UTC, Ki Rill wrote:
How do I generate `setX` methods for all private mutable
variables in my class? Do I need to use `__traits`?
```d
mixin template GenerateSetters() {
static foreach (idx, field; typeof(this).tupleof) static if
On Monday, 5 June 2023 at 18:14:31 UTC, DLearner wrote:
On Monday, 5 June 2023 at 14:25:33 UTC, Mike Parker wrote:
[...]
Thank you for the link, can confirm that:
```
int foo() {
[...]
It's not so easy to deal automatically in case of multiple modules
On Monday, 5 June 2023 at 14:25:33 UTC, Mike Parker wrote:
[...]
The docs say it should work:
https://dlang.org/spec/betterc.html#unittests
[...]
Thank you for the link, can confirm that:
```
int foo() {
return 4;
}
unittest {
assert(foo() != 4, "!= Assert triggered.");
On Monday, 5 June 2023 at 15:13:43 UTC, Basile B. wrote:
On Monday, 5 June 2023 at 13:57:20 UTC, Ki Rill wrote:
How do I generate `setX` methods for all private mutable
although I did not spent time on the setter body... I suppose
the question was more about the metprogramming technic, and
On Monday, 5 June 2023 at 13:57:20 UTC, Ki Rill wrote:
How do I generate `setX` methods for all private mutable
variables in my class? Do I need to use `__traits`?
I need this for my
[tiny-svg](https://github.com/rillki/tiny-svg) project to
generate `setX` methods for all Shapes.
Example:
On Monday, 5 June 2023 at 14:29:35 UTC, Richard (Rikki) Andrew
Cattermole wrote:
On 06/06/2023 2:25 AM, Mike Parker wrote:
On Monday, 5 June 2023 at 14:16:39 UTC, ryuukk_ wrote:
In my book this is broken and needs to be fixed, as a user i
don't care about under the hood things, it's a you
On Monday, 5 June 2023 at 13:57:20 UTC, Ki Rill wrote:
How do I generate `setX` methods for all private mutable
variables in my class? Do I need to use `__traits`?
I need this for my
[tiny-svg](https://github.com/rillki/tiny-svg) project to
generate `setX` methods for all Shapes.
Example:
On Monday, 5 June 2023 at 14:16:39 UTC, ryuukk_ wrote:
In my book this is broken and needs to be fixed, as a user i
don't care about under the hood things, it's a you problem,
user should be able to unit test
The docs say it should work:
https://dlang.org/spec/betterc.html#unittests
So
On 06/06/2023 2:25 AM, Mike Parker wrote:
On Monday, 5 June 2023 at 14:16:39 UTC, ryuukk_ wrote:
In my book this is broken and needs to be fixed, as a user i don't
care about under the hood things, it's a you problem, user should be
able to unit test
The docs say it should work:
On 06/06/2023 2:16 AM, ryuukk_ wrote:
In my book this is broken and needs to be fixed, as a user i don't care
about under the hood things, it's a you problem, user should be able to
unit test
If you as the user disable key components required for the language to
fully work, its a you
On Monday, 5 June 2023 at 11:41:08 UTC, Richard (Rikki) Andrew
Cattermole wrote:
On 05/06/2023 3:42 PM, ryuukk_ wrote:
I don't know how all this works, but the runtime shouldn't
know about tests, imagine if you ship a game, and the player
can run all the unittests, that doesn't make sense
How do I generate `setX` methods for all private mutable
variables in my class? Do I need to use `__traits`?
I need this for my [tiny-svg](https://github.com/rillki/tiny-svg)
project to generate `setX` methods for all Shapes.
Example:
```D
class Rectangle {
private immutable ...;
On 05/06/2023 3:42 PM, ryuukk_ wrote:
I don't know how all this works, but the runtime shouldn't know about
tests, imagine if you ship a game, and the player can run all the
unittests, that doesn't make sense
Currently that is not possible. When you turn on unittests to be
compiled in, that
On Monday, 5 June 2023 at 10:01:01 UTC, John Xu wrote:
The parseDOM returns a DOMEntity(R) type, how do I write a
xmlRoot as global variable?
I need its detailed type (auto / Variant doesn't work).
import dxml.dom;
?? xmlRoot;
int main() {
string xml =
The parseDOM returns a DOMEntity(R) type, how do I write a
xmlRoot as global variable?
I need its detailed type (auto / Variant doesn't work).
import dxml.dom;
?? xmlRoot;
int main() {
string xml = readText("a.xml");
auto dom = parseDOM(xml);
On Monday, 5 June 2023 at 03:42:20 UTC, ryuukk_ wrote:
[...]
I don't know how all this works, ...
For what it is worth, running _both_ the above code fragments
with:
```
dmd -main -unittest -i -run foo
```
(ie removing the -betterC flag)
produces:
```
foo.d(8): [unittest] != Assert
19 matches
Mail list logo