What could this be?

2020-05-11 Thread Joel via Digitalmars-d-learn
I'm gotten stuck with this error - "..is not visible from module.."

Re: What could this be?

2020-05-11 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 11 May 2020 at 11:20:51 UTC, Joel wrote: I'm gotten stuck with this error - "..is not visible from module.." Without some code it's hard to say exactly, but this generally means you're referencing a private symbol in a different module: module foo; private struct S {} module bar;

Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
Why doesn't it compile? ``` struct Range(R) { import std.array : empty, front, popFront; R range; bool empty() const { return range.empty; } auto front() const { return range.front; } void popFront() { range.popFront(); } } void main() { auto rng = Range!string("1234");

Re: Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 11 May 2020 at 12:20:06 UTC, Jack Applegame wrote: assert(rng.front == 1); Damn! I made a typo. It must be: assert(rng.front == '1') So the second example works fine.

Re: Bug?

2020-05-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 11 May 2020 at 12:20:06 UTC, Jack Applegame wrote: If you move the import to the global scope UFCS is only defined to work with global scope functions. A restricted import (module : symbol, symbols) puts things in local scope so ufcs doesn't apply. (interestingly an unrestricted

Re: Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
And the first example still doesn't compile: ``` struct Range(R) { import std.array : empty, front, popFront; R range; bool empty() const { return range.empty; } auto front() const { return range.front; } void popFront() { range.popFront(); } } void main() { auto rng

Re: Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 11 May 2020 at 12:30:22 UTC, Adam D. Ruppe wrote: UFCS is only defined to work with global scope functions. A restricted import (module : symbol, symbols) puts things in local scope so ufcs doesn't apply. But in this case the error should be displayed for lines 4 and 5, not 11. Li

Re: Bug?

2020-05-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/11/20 8:44 AM, Jack Applegame wrote: On Monday, 11 May 2020 at 12:30:22 UTC, Adam D. Ruppe wrote: UFCS is only defined to work with global scope functions. A restricted import (module : symbol, symbols) puts things in local scope so ufcs doesn't apply. But in this case the error should b

Re: Bug?

2020-05-11 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 11 May 2020 at 12:44:45 UTC, Jack Applegame wrote: On Monday, 11 May 2020 at 12:30:22 UTC, Adam D. Ruppe wrote: UFCS is only defined to work with global scope functions. A restricted import (module : symbol, symbols) puts things in local scope so ufcs doesn't apply. But in this cas

Re: Bug?

2020-05-11 Thread Jack Applegame via Digitalmars-d-learn
On Monday, 11 May 2020 at 13:12:37 UTC, Simen Kjærås wrote: Filed here: https://issues.dlang.org/show_bug.cgi?id=20821 Thanks.

Re: Bug?

2020-05-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 11 May 2020 at 13:06:59 UTC, Steven Schveighoffer wrote: Clearly something isn't connecting properly, it's almost like it's resolving to the function itself instead of calling it. Since the imported front is also a local symbol the compiler probably thinks it is overloaded and not h

Dub and Unit_Threaded

2020-05-11 Thread Russel Winder via Digitalmars-d-learn
This seems nonsensical to me. Why is Dub using the correct (0.10.8) version of Unit_Threaded for building the tests, but then using an earlier version (0.10.6) for building and running the test. If I remove 0.10.6 from the .dub/packages directory, then it uses 0.10.8 correctly. Then it complains ab

D and Async I/O

2020-05-11 Thread Russel Winder via Digitalmars-d-learn
OK, so I need to create an asynchronous TCP server (not HTTP or HTTPS, this is a real server ;-) ). I think the normal response is "Use Vibe.d". However, recently I see Hunt is an alternative. Has anyone any way of choosing between the two? I notice that Hunt uses it's own library eschewing all o

Re: GUI library for DMD 2.090 or DMD 2.091

2020-05-11 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2020-04-27 at 12:12 +, Antonio Corbi via Digitalmars-d-learn wrote: > On Monday, 27 April 2020 at 11:27:57 UTC, Paulo Pinto wrote: > > On Sunday, 26 April 2020 at 09:09:04 UTC, Antonio Corbi wrote: […] > > > I don't know if you are referring to the `clone!` macro > > > described here[1

Re: Integration tests

2020-05-11 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2020-04-22 at 11:19 +, aliak via Digitalmars-d-learn wrote: > On Wednesday, 22 April 2020 at 10:32:48 UTC, Russel Winder wrote: > > Now I discover Python, Rust, and Go have far nicer abstractions > > for writing Internet code than D does. Does D really not have a > > TcpListener abstr

Re: D and Async I/O

2020-05-11 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, May 11, 2020 at 4:03 PM Russel Winder via Digitalmars-d-learn wrote: > > ... > I notice that Hunt uses it's own library eschewing all of Phobos. Is this an > indicator that Phobos is not suitable for networking activity? Vibe-d do that too, But https://code.dlang.org/packages/async use pho

Re: D and Async I/O

2020-05-11 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2020-05-11 at 15:02 +0100, Russel Winder wrote: > OK, so I need to create an asynchronous TCP server (not HTTP or HTTPS, this > is > a real server ;-) ). > > I think the normal response is "Use Vibe.d". However, recently I see Hunt is > an alternative. Has anyone any way of choosing betwee

Re: D and Async I/O

2020-05-11 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2020-05-11 at 16:36 +0200, Daniel Kozak via Digitalmars-d-learn wrote: > On Mon, May 11, 2020 at 4:03 PM Russel Winder via Digitalmars-d-learn > wrote: > > ... > > I notice that Hunt uses it's own library eschewing all of Phobos. Is this > > an > > indicator that Phobos is not suitable for

Re: Integration tests

2020-05-11 Thread Luis via Digitalmars-d-learn
On Wednesday, 22 April 2020 at 10:32:48 UTC, Russel Winder wrote: I ended up creating the following project structure: . ├── dub.sdl ├── dub.selections.json ├── source │ ├── arcam_protocol.d │ └── main.d ├── tests │ └── integration_tests.d └── test_support └── mock_avr850 └── m

Re: D and Async I/O

2020-05-11 Thread bauss via Digitalmars-d-learn
On Monday, 11 May 2020 at 14:02:54 UTC, Russel Winder wrote: OK, so I need to create an asynchronous TCP server (not HTTP or HTTPS, this is a real server ;-) ). I think the normal response is "Use Vibe.d". However, recently I see Hunt is an alternative. Has anyone any way of choosing between

Different visibility in template for class and struct?

2020-05-11 Thread Shigeki Karita via Digitalmars-d-learn
Why is local struct visible in this outer template, while local class is not? https://wandbox.org/permlink/MfsDa68qgaMSIr4a https://dlang.org/spec/template.html#instantiation_scope --- enum p(T) = __traits(compiles, new T()); class GlobalC {} struct GlobalS {} void main() { class LocalC

Re: Different visibility in template for class and struct?

2020-05-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/11/20 11:11 AM, Shigeki Karita wrote: Why is local struct visible in this outer template, while local class is not? https://wandbox.org/permlink/MfsDa68qgaMSIr4a https://dlang.org/spec/template.html#instantiation_scope --- enum p(T) = __traits(compiles, new T()); class GlobalC {} struc

Re: Different visibility in template for class and struct?

2020-05-11 Thread Shigeki Karita via Digitalmars-d-learn
On Monday, 11 May 2020 at 15:29:53 UTC, Steven Schveighoffer wrote: On 5/11/20 11:11 AM, Shigeki Karita wrote: [...] First, it actually does compile, I think because the compiler recognizes that LocalS is POD (plain old data), without methods, so it doesn't need a context pointer. e.g.: a

Re: Different visibility in template for class and struct?

2020-05-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/11/20 11:40 AM, Shigeki Karita wrote: On Monday, 11 May 2020 at 15:29:53 UTC, Steven Schveighoffer wrote: On 5/11/20 11:11 AM, Shigeki Karita wrote: [...] First, it actually does compile, I think because the compiler recognizes that LocalS is POD (plain old data), without methods, so it

Re: D and Async I/O

2020-05-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-05-11 16:44, Russel Winder wrote: Crickey, a third option. This wil increase my dithering! ;-) Forth: Mecca [1] :) [1] https://github.com/weka-io/mecca -- /Jacob Carlborg

Re: Error running concurrent process and storing results in array

2020-05-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-05-07 02:17, data pulverizer wrote: What is the difference between -O2 and -O3 ldc2 compiler optimizations? `--help` says -O2 is "Good optimizations" and -O3 "Aggressive optimizations". Not very specific. -- /Jacob Carlborg

Re: Different visibility in template for class and struct?

2020-05-11 Thread Shigeki Karita via Digitalmars-d-learn
On Monday, 11 May 2020 at 16:10:36 UTC, Steven Schveighoffer wrote: On 5/11/20 11:40 AM, Shigeki Karita wrote: On Monday, 11 May 2020 at 15:29:53 UTC, Steven Schveighoffer wrote: [...] Thanks for your answer. Now I understand that POD matters here. When I add a dtor: `struct LocalS { ~this()

Re: How to port C++ std::is_reference to D ?

2020-05-11 Thread Q. Schroll via Digitalmars-d-learn
On Saturday, 9 May 2020 at 13:44:27 UTC, Per Nordlöw wrote: On Wednesday, 6 May 2020 at 17:46:28 UTC, Q. Schroll wrote: C++'s decision to make references part of the type has some advantages, but D didn't do it because of many disadvantages. Can you outline or give a link describing the advan

Re: D and Async I/O

2020-05-11 Thread ikod via Digitalmars-d-learn
On Monday, 11 May 2020 at 17:34:41 UTC, Jacob Carlborg wrote: On 2020-05-11 16:44, Russel Winder wrote: Crickey, a third option. This wil increase my dithering! ;-) Forth: Mecca [1] :) [1] https://github.com/weka-io/mecca And probably more. At least I also have my async library for networ

Re: D and Async I/O

2020-05-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/11/20 3:46 PM, ikod wrote: On Monday, 11 May 2020 at 17:34:41 UTC, Jacob Carlborg wrote: On 2020-05-11 16:44, Russel Winder wrote: Crickey, a third option. This wil increase my dithering! ;-) Forth: Mecca [1] :) [1] https://github.com/weka-io/mecca And probably more. At least I also

Re: D and Async I/O

2020-05-11 Thread ikod via Digitalmars-d-learn
On Monday, 11 May 2020 at 21:15:28 UTC, Steven Schveighoffer wrote: On 5/11/20 3:46 PM, ikod wrote: On Monday, 11 May 2020 at 17:34:41 UTC, Jacob Carlborg wrote: On 2020-05-11 16:44, Russel Winder wrote: Crickey, a third option. This wil increase my dithering! ;-) Forth: Mecca [1] :) [1] h

Probably a trivial question regarding version identifier and unittest

2020-05-11 Thread WhatMeWorry via Digitalmars-d-learn
I'm trying to study Adam Ruppe's terminal.d sub-package and I see the following code segment: version(demos) unittest { import arsd.terminal; void main() { // . . . } main; // exclude from docs } Looks like a good baby step to take, so in the command line I use:

Re: Probably a trivial question regarding version identifier and unittest

2020-05-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/11/20 9:54 PM, WhatMeWorry wrote: I'm trying to study Adam Ruppe's terminal.d sub-package and I see the following code segment: version(demos) unittest {     import arsd.terminal;     void main()     {     // . . .     }     main; // exclude from docs } Looks like a good bab

Re: Probably a trivial question regarding version identifier and unittest

2020-05-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 12 May 2020 at 01:54:49 UTC, WhatMeWorry wrote: version(demos) unittest { import arsd.terminal; void main() Shouldn't the version identifier demos and the unittest option activate the test block and therefore defines main() which then give the "Start Address"? The unitte

Get unknown symbol (struct, method, class) tagged with User Defined Attributes

2020-05-11 Thread Doug via Digitalmars-d-learn
I've seen a lot of examples of how to get a list of User Defined Attributes from a known symbol but I haven't seen any for how to get a list of symbols when only the UDA is known. The use case is the same as seen in Rust with Serde[1]. Library users annotate a struct to mark it for serializati

Re: Get unknown symbol (struct, method, class) tagged with User Defined Attributes

2020-05-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 12 May 2020 at 02:51:39 UTC, Doug wrote: So far I've only seen a way to get unknown UDAs from known symbols but not how to get unknown symbols from UDAs. Is there any documentation for how to get a list of symbols annotated with a specific UDA? see std.traits.getSymbolsByUDA http

Re: What could this be?

2020-05-11 Thread Joel via Digitalmars-d-learn
On Monday, 11 May 2020 at 11:37:40 UTC, Simen Kjærås wrote: On Monday, 11 May 2020 at 11:20:51 UTC, Joel wrote: I'm gotten stuck with this error - "..is not visible from module.." Without some code it's hard to say exactly, but this generally means you're referencing a private symbol in a dif

Re: Get unknown symbol (struct, method, class) tagged with User Defined Attributes

2020-05-11 Thread Doug via Digitalmars-d-learn
On Tuesday, 12 May 2020 at 02:53:53 UTC, Adam D. Ruppe wrote: see std.traits.getSymbolsByUDA Thanks for the link. I did see that one. But that function searches within known symbols. My use case if for a library that's used outside of my application. In that case, I wouldn't know which symb

Re: Probably a trivial question regarding version identifier and unittest

2020-05-11 Thread WhatMe Worry via Digitalmars-d-learn
On Tuesday, 12 May 2020 at 02:17:36 UTC, Adam D. Ruppe wrote: On Tuesday, 12 May 2020 at 01:54:49 UTC, WhatMeWorry wrote: [...] The unittest {} block is actually a special syntax for a function. So the main function in here is a *nested* function inside the unittest function and thus doesn't

Re: Get unknown symbol (struct, method, class) tagged with User Defined Attributes

2020-05-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/11/20 11:30 PM, Doug wrote: On Tuesday, 12 May 2020 at 02:53:53 UTC, Adam D. Ruppe wrote: see std.traits.getSymbolsByUDA Thanks for the link. I did see that one. But that function searches within known symbols. My use case if for a library that's used outside of my application. In that