Re: why is it a class property cannot be used like a.b ~= c; ?

2021-09-04 Thread someone via Digitalmars-d-learn
On Saturday, 4 September 2021 at 23:57:09 UTC, jfondren wrote: You're returning a copy of a slice, so if this compiled nothing useful would happen anyway. This works if `whatever()` returns `ref dstring` instead, with no other changes. Search https://dlang.org/spec/function.html for 'lvalue'

Re: Why can't the DMD compiler accept files or directories with white spaces even delimited by quotes?

2021-09-04 Thread Marcone via Digitalmars-d-learn
On Sunday, 5 September 2021 at 00:00:33 UTC, jfondren wrote: On Saturday, 4 September 2021 at 23:50:33 UTC, Marcone wrote: Example: dmd "hello world.d" ``` $ cat hello\ world.d module helloworld; void main() { import std.stdio : writeln; writeln("without the explicit 'module', this

Re: Why can't the DMD compiler accept files or directories with white spaces even delimited by quotes?

2021-09-04 Thread jfondren via Digitalmars-d-learn
On Saturday, 4 September 2021 at 23:50:33 UTC, Marcone wrote: Example: dmd "hello world.d" ``` $ cat hello\ world.d module helloworld; void main() { import std.stdio : writeln; writeln("without the explicit 'module', this file would"); writeln("be inferred to have an invalid

Re: why is it a class property cannot be used like a.b ~= c; ?

2021-09-04 Thread jfondren via Digitalmars-d-learn
On Saturday, 4 September 2021 at 23:33:39 UTC, someone wrote: ```d public class cSomething { private: dstring pstrWhatever = null; public: @safe dstring whatever() { return pstrWhatever; } @safe void whatever(const dstring lstrWhatever) { pstrWhatever = lstrWhatever; } }

Why can't the DMD compiler accept files or directories with white spaces even delimited by quotes?

2021-09-04 Thread Marcone via Digitalmars-d-learn
Example: dmd "hello world.d"

Re: Phobos Unittest

2021-09-04 Thread jfondren via Digitalmars-d-learn
On Saturday, 4 September 2021 at 20:06:27 UTC, Per Nordlöw wrote: On Saturday, 4 September 2021 at 20:05:17 UTC, Per Nordlöw wrote: ```sh time dmd import_std.d -o- ``` should be ```sh time dmd -unittest import_std.d -o- ``` When you generate the object files, I get 13K vs. 75K from a file

why is it a class property cannot be used like a.b ~= c; ?

2021-09-04 Thread someone via Digitalmars-d-learn
```d public class cSomething { private: dstring pstrWhatever = null; public: @safe dstring whatever() { return pstrWhatever; } @safe void whatever(const dstring lstrWhatever) { pstrWhatever = lstrWhatever; } } void main() { cSomething lobjSomething = new cSomething();

Re: Phobos Unittest

2021-09-04 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 4 September 2021 at 20:05:17 UTC, Per Nordlöw wrote: ```sh time dmd import_std.d -o- ``` should be ```sh time dmd -unittest import_std.d -o- ```

Re: Phobos Unittest

2021-09-04 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 4 September 2021 at 13:12:49 UTC, Steven Schveighoffer wrote: Note that lexing and parsing is extremely quick, and I wouldn't focus on trying to trim this out, you won't get much performance out of that. -Steve For the record, a D file containing only `import std;` type checks

Absence of isAllocator trait

2021-09-04 Thread Per Nordlöw via Digitalmars-d-learn
Is there a reason for the absence of an `isAllocator` trait under `std.experimental.allocator`?

Re: Piping from terminal into D program

2021-09-04 Thread eXodiquas via Digitalmars-d-learn
On Saturday, 4 September 2021 at 18:20:51 UTC, WebFreak001 wrote: On Saturday, 4 September 2021 at 15:41:51 UTC, eXodiquas wrote: [...] to extend on Brian Tiffin's reply, you can read from the standard input stream (the data piped to your program) using std.stdio's `stdin` [...] Brian

Re: Piping from terminal into D program

2021-09-04 Thread WebFreak001 via Digitalmars-d-learn
On Saturday, 4 September 2021 at 15:41:51 UTC, eXodiquas wrote: Hello everyone, I created a small little D program that reads in a string from the command line and shuffles the letters of the nouns a bit around. This is pretty straight forward, but what I see now happening is a bit strange,

Re: Piping from terminal into D program

2021-09-04 Thread Brian Tiffin via Digitalmars-d-learn
On Saturday, 4 September 2021 at 15:41:51 UTC, eXodiquas wrote: Hello everyone, I created a small little D program that reads in a string from the command line and shuffles the letters of the nouns a bit around. This is pretty straight forward, but what I see now happening is a bit strange,

Piping from terminal into D program

2021-09-04 Thread eXodiquas via Digitalmars-d-learn
Hello everyone, I created a small little D program that reads in a string from the command line and shuffles the letters of the nouns a bit around. This is pretty straight forward, but what I see now happening is a bit strange, at least for me. I am reading the args out of the main function

Re: Phobos Unittest

2021-09-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/4/21 7:43 AM, Johan wrote: On Saturday, 4 September 2021 at 03:18:01 UTC, Paul Backus wrote: On Saturday, 4 September 2021 at 00:09:37 UTC, H. S. Teoh wrote: This is related to the bogonity of the current behaviour of -unittest, which compiles *all* unittests of *all* imported modules,

Re: Phobos Unittest

2021-09-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/4/21 5:42 AM, Per Nordlöw wrote: On Saturday, 4 September 2021 at 03:18:01 UTC, Paul Backus wrote: As Steven Schveighoffer [pointed out][1], Phobos unittests are never included in user code, regardless of whether `StdUnittest` is used. Yes, but they are lexed and parsed, right? Yes,

Re: Phobos Unittest

2021-09-04 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 4 September 2021 at 12:40:02 UTC, Per Nordlöw wrote: Omg. It really seems like it's motivated to do a benchmark with phobos unittests prefixed with Should have been a reply to The "never" is false, https://d.godbolt.org/z/c4oeYM7rG

Re: Phobos Unittest

2021-09-04 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 4 September 2021 at 12:40:02 UTC, Per Nordlöw wrote: then. I can make that refactoring in my favorite choice of editor and see the result differ. In terms of binary size, and speed and memory usage of check, build and link time. Automated that is. If we want this, shall we

Re: Phobos Unittest

2021-09-04 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 4 September 2021 at 12:31:33 UTC, Dennis wrote: On Saturday, 4 September 2021 at 09:42:46 UTC, Per Nordlöw wrote: Yes, but they are lexed and parsed, right? Right, but that's the case regardless of `version(StdUnittest)`. Omg. It really seems like it's motivated to do a

Re: Phobos Unittest

2021-09-04 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 4 September 2021 at 12:31:33 UTC, Dennis wrote: Right, but that's the case regardless of `version(StdUnittest)`. I don't think so. My guess is that `version(StdUnittest)` does maximum parsing, maybe only lexing. How can one easily determine if this is the fact? Behaviour of

Re: Phobos Unittest

2021-09-04 Thread Dennis via Digitalmars-d-learn
On Saturday, 4 September 2021 at 09:42:46 UTC, Per Nordlöw wrote: Yes, but they are lexed and parsed, right? Right, but that's the case regardless of `version(StdUnittest)`.

Re: Phobos Unittest

2021-09-04 Thread Johan via Digitalmars-d-learn
On Saturday, 4 September 2021 at 03:18:01 UTC, Paul Backus wrote: On Saturday, 4 September 2021 at 00:09:37 UTC, H. S. Teoh wrote: This is related to the bogonity of the current behaviour of -unittest, which compiles *all* unittests of *all* imported modules, even when you're compiling user

Re: Dustmite and linking error

2021-09-04 Thread JG via Digitalmars-d-learn
On Saturday, 4 September 2021 at 08:54:31 UTC, Mike Parker wrote: On Saturday, 4 September 2021 at 08:19:53 UTC, JG wrote: [...] You should be able to do that now with "sourceFiles" and "sourcePaths". Just avoid the default "source" or "src" directories and specify the paths and/or files

Re: Phobos Unittest

2021-09-04 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 4 September 2021 at 03:18:01 UTC, Paul Backus wrote: As Steven Schveighoffer [pointed out][1], Phobos unittests are never included in user code, regardless of whether `StdUnittest` is used. Yes, but they are lexed and parsed, right?

Re: Dustmite and linking error

2021-09-04 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 4 September 2021 at 08:19:53 UTC, JG wrote: As a small comment regarding dub. I can't help wondering if it really the best idea for each configuration to include everything by default and then have to exclude things? This means that when you add another configuration and source

Re: Dustmite and linking error

2021-09-04 Thread JG via Digitalmars-d-learn
On Saturday, 4 September 2021 at 08:05:16 UTC, JG wrote: On Saturday, 4 September 2021 at 07:40:07 UTC, Vladimir Panteleev wrote: On Saturday, 4 September 2021 at 07:38:34 UTC, Andre Pany wrote: The Dustmite condition you are using seems very generic, therefore this error message can be

Re: Dustmite and linking error

2021-09-04 Thread JG via Digitalmars-d-learn
On Saturday, 4 September 2021 at 07:40:07 UTC, Vladimir Panteleev wrote: On Saturday, 4 September 2021 at 07:38:34 UTC, Andre Pany wrote: The Dustmite condition you are using seems very generic, therefore this error message can be triggered by various code constellations. This might be the

Re: Dustmite and linking error

2021-09-04 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 4 September 2021 at 07:38:34 UTC, Andre Pany wrote: The Dustmite condition you are using seems very generic, therefore this error message can be triggered by various code constellations. This might be the reasons why Dustmite is running so long. Overly generic test conditions

Re: Dustmite and linking error

2021-09-04 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 2 September 2021 at 11:04:12 UTC, JG wrote: Hi, We hit a linking error (after upgrading to dub 1.26.0). I thought I would try to use dustmite to create a reduced error test case. One week later it is still running (depth 22). I don't suppose there is anyway of determining when

Re: Dustmite and linking error

2021-09-04 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 4 September 2021 at 06:18:52 UTC, JG wrote: I tried again. What am I doing wrong? cp source ~/tmp/source cd ~/tmp/source dub build --config prog1 2>&1 | grep "collect2: error: ld returned 1 exit status" echo $? #produces 0 find . -name *.o -delete ~/d/DustMite/dustmite -j ./ 'dub

Re: Dustmite and linking error

2021-09-04 Thread JG via Digitalmars-d-learn
On Saturday, 4 September 2021 at 06:18:52 UTC, JG wrote: On Friday, 3 September 2021 at 19:56:30 UTC, JG wrote: [...] I tried again. What am I doing wrong? cp source ~/tmp/source cd ~/tmp/source dub build --config prog1 2>&1 | grep "collect2: error: ld returned 1 exit status" echo $?

Re: Dustmite and linking error

2021-09-04 Thread JG via Digitalmars-d-learn
On Friday, 3 September 2021 at 19:56:30 UTC, JG wrote: On Thursday, 2 September 2021 at 17:56:54 UTC, Vladimir Panteleev wrote: On Thursday, 2 September 2021 at 11:20:18 UTC, Vladimir Panteleev wrote: One way to get a very rough estimate is to take the square of the current reduction (.reduced