Re: tupleof seems to break encapsulation

2020-09-04 Thread 60rntogo via Digitalmars-d-learn
On Friday, 4 September 2020 at 17:36:00 UTC, Jacob Carlborg wrote: It's useful for serialization and, as you can see in your example, for debugging as well. `writeln` will print the values of the fields in a struct, even for private fields. I wouldn't dispute that it is useful, but that's

Re: Install multiple executables with DUB

2020-09-04 Thread glis-glis via Digitalmars-d-learn
On Thursday, 3 September 2020 at 14:34:48 UTC, Jacob Carlborg wrote: Oh, multiple binaries, I missed that. You can try to add multiple configurations [1]. Or if you have executables depending on only one source file, you can use single-file packages [2]. Thanks, but this still means I would

Re: Install multiple executables with DUB

2020-09-04 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 3 September 2020 at 08:22:25 UTC, glis-glis wrote: Hi, I have a few modules for parsing different file formats and a folder with d-scripts using these parsers to perform manipulations, extract information, ... Until now, I just added #!/usr/bin/env rdmd to the d-scripts and

Re: Install multiple executables with DUB

2020-09-04 Thread drug via Digitalmars-d-learn
On 9/4/20 10:27 AM, glis-glis wrote: On Thursday, 3 September 2020 at 14:34:48 UTC, Jacob Carlborg wrote: Oh, multiple binaries, I missed that. You can try to add multiple configurations [1]. Or if you have executables depending on only one source file, you can use single-file packages [2].

Re: Install multiple executables with DUB

2020-09-04 Thread Jon Degenhardt via Digitalmars-d-learn
On Friday, 4 September 2020 at 07:27:33 UTC, glis-glis wrote: On Thursday, 3 September 2020 at 14:34:48 UTC, Jacob Carlborg wrote: Oh, multiple binaries, I missed that. You can try to add multiple configurations [1]. Or if you have executables depending on only one source file, you can use

Re: tupleof seems to break encapsulation

2020-09-04 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 4 September 2020 at 10:16:47 UTC, 60rntogo wrote: Consider the following code. foo.d --- module foo; struct Foo { private int i; } --- main.d --- void main() { import std.stdio; import foo; auto x = Foo(); writeln(x); // ++x.i; ++x.tupleof[0]; writeln(x); } --- As

tupleof seems to break encapsulation

2020-09-04 Thread 60rntogo via Digitalmars-d-learn
Consider the following code. foo.d --- module foo; struct Foo { private int i; } --- main.d --- void main() { import std.stdio; import foo; auto x = Foo(); writeln(x); // ++x.i; ++x.tupleof[0]; writeln(x); } --- As expected, the commented line does not compile. If I uncomment

Re: How to use std.net.curl with specific curl query?

2020-09-04 Thread Italomania via Digitalmars-d-learn
Nice, I have been having this problem for quite a while too. Thanks

Re: Problem with gfm.math.matrix (some gamedevs out there ?)

2020-09-04 Thread Guillaume Piolat via Digitalmars-d-learn
On Thursday, 3 September 2020 at 12:36:35 UTC, Thomas wrote: - import std.stdio; int main() { import gfm.math.matrix; const int width = 800; const int height = 600; auto projectionMatrix = mat4!(float).identity(); Note that instead of `mat4!(float)` you

Re: I think Associative Array should throw Exception

2020-09-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/4/20 1:48 AM, Jesse Phillips wrote: On Thursday, 3 September 2020 at 15:12:14 UTC, Steven Schveighoffer wrote: int[int] aa; aa[4] = 5; auto b = aa[4]; How is this code broken? It's valid, will never throw, and there's no reason that we should break it by adding an exception into the mix.

Re: I think Associative Array should throw Exception

2020-09-04 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 1 September 2020 at 18:20:17 UTC, Jesse Phillips wrote: This is going to be a hard one for me to argue but I'm going to give it a try. Today if you attempt to access a key from an associative array (AA) that does not exist inside the array, a RangeError is thrown. This is similar

Re: tupleof seems to break encapsulation

2020-09-04 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Sep 04, 2020 at 07:36:00PM +0200, Jacob Carlborg via Digitalmars-d-learn wrote: [...] > It's useful for serialization and, as you can see in your example, for > debugging as well. `writeln` will print the values of the fields in a > struct, even for private fields. It's certainly useful,

Re: tupleof seems to break encapsulation

2020-09-04 Thread Paul Backus via Digitalmars-d-learn
On Friday, 4 September 2020 at 18:23:09 UTC, H. S. Teoh wrote: On Fri, Sep 04, 2020 at 07:36:00PM +0200, Jacob Carlborg via Digitalmars-d-learn wrote: [...] It's useful for serialization and, as you can see in your example, for debugging as well. `writeln` will print the values of the fields

Re: tupleof seems to break encapsulation

2020-09-04 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-09-04 12:16, 60rntogo wrote: Consider the following code. foo.d --- module foo; struct Foo {   private int i; } --- main.d --- void main() {   import std.stdio;   import foo;   auto x = Foo();   writeln(x);   // ++x.i;   ++x.tupleof[0];   writeln(x); } --- As expected, the