std.algorithm.cmp is conflicting with itself.

2022-08-11 Thread realhet via Digitalmars-d-learn
Hello, I try to make an overload group of cmp() functions in my utility module but everything works well except when I import some 3rd party module that imports std.algorithm. Then I get an error: C:\D\testCmpOverload.d(11,8): Error: function `std.algorithm.comparison.cmp!(string, string).cmp`

Re: std.algorithm.cmp is conflicting with itself.

2022-08-11 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 11 August 2022 at 17:46:00 UTC, realhet wrote: Here's the utility module: ```d module testcmpmodule; //publicly output these modules, like I did in my always used 'utils' module. public import std.algorithm, std.math, std.stdio; import std.range, std.traits; //create function ov

Re: std.algorithm.cmp is conflicting with itself.

2022-08-11 Thread realhet via Digitalmars-d-learn
On Thursday, 11 August 2022 at 18:10:31 UTC, Paul Backus wrote: ... If you remove `std.algorithm` from `testcmpmodule2`'s `public import` line, the code compiles successfully. Yes, but in the 40 module project I'm unable to make it work. I doublechecked that the only public import of std.algori

Re: std.algorithm.cmp is conflicting with itself.

2022-08-11 Thread bachmeier via Digitalmars-d-learn
On Thursday, 11 August 2022 at 18:32:54 UTC, realhet wrote: On Thursday, 11 August 2022 at 18:10:31 UTC, Paul Backus wrote: ... If you remove `std.algorithm` from `testcmpmodule2`'s `public import` line, the code compiles successfully. Yes, but in the 40 module project I'm unable to make it wo

Re: My programs issues

2022-08-11 Thread pascal111 via Digitalmars-d-learn
Next code receiving an input from the user and reprint it in capital letters with a separator between each letter, but I think that there is more to add or to modify the way this program working with: '''D module main; import std.stdio; import std.uni; import std.string; import std.algorithm

How to use exceptions

2022-08-11 Thread Christian Köstlin via Digitalmars-d-learn
Dear d-lang experts, lets say in general I am quite happy with exceptions. Recently though I stumbled upon two problems with them: 1. Its quite simple to loose valuable information 2. Its hard to present the exception messages to end users of your program Let me elaborate on those: Lets take

Re: std.algorithm.cmp is conflicting with itself.

2022-08-11 Thread realhet via Digitalmars-d-learn
On Thursday, 11 August 2022 at 19:33:31 UTC, bachmeier wrote: std.string does a public import of std.algorithm.cmp. That was it! Thanks! Conclusion: This is how to overload cmp() ```d //this is the only place from where all other modules can see these std modules public import std.string, s

Re: How to use exceptions

2022-08-11 Thread Adam D Ruppe via Digitalmars-d-learn
You might find my recent blog post interesting too: http://dpldocs.info/this-week-in-d/Blog.Posted_2022_08_01.html#exception-template-concept and a draft of some more concepts: http://arsd-official.dpldocs.info/source/arsd.exception.d.html I also find the lack of information disturbing, but I

Re: How to use exceptions

2022-08-11 Thread Christian Köstlin via Digitalmars-d-learn
On 12.08.22 01:06, Adam D Ruppe wrote: You might find my recent blog post interesting too: http://dpldocs.info/this-week-in-d/Blog.Posted_2022_08_01.html#exception-template-concept and a draft of some more concepts: http://arsd-official.dpldocs.info/source/arsd.exception.d.html I also find th

Re: How to use exceptions

2022-08-11 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Aug 11, 2022 at 11:06:45PM +, Adam D Ruppe via Digitalmars-d-learn wrote: > You might find my recent blog post interesting too: > > http://dpldocs.info/this-week-in-d/Blog.Posted_2022_08_01.html#exception-template-concept > > and a draft of some more concepts: > http://arsd-official.

Re: How to use exceptions

2022-08-11 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 11 August 2022 at 23:50:58 UTC, H. S. Teoh wrote: I think the OP's idea is somewhat different: adding contextual information to a propagating exception that the throwing code may not have access to. Yeah, but you can use the mechanism again: you'd catch the one then throw a new o

Re: How to use exceptions

2022-08-11 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Aug 12, 2022 at 12:12:13AM +, Adam D Ruppe via Digitalmars-d-learn wrote: > On Thursday, 11 August 2022 at 23:50:58 UTC, H. S. Teoh wrote: > > I think the OP's idea is somewhat different: adding contextual > > information to a propagating exception that the throwing code may > > not ha

Re: How to use exceptions

2022-08-11 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 12 August 2022 at 00:40:48 UTC, H. S. Teoh wrote: Hmm! That gets me thinking. Maybe something like this? aye. and scopes share dtors which means we can do it in the lib today: --- struct AdditionalInfo { static string[] info; this(string info) { A

Re: My programs issues

2022-08-11 Thread pascal111 via Digitalmars-d-learn
This is a program for duplicating files, I made some changes on it, and liked to share it may that I get a new advice on it: '''D module main; // D programming language import std.stdio; import std.string; import std.algorithm; import dcollect; int main(string[] args) { string s; //char[] f

Re: std.algorithm.cmp is conflicting with itself.

2022-08-11 Thread bachmeier via Digitalmars-d-learn
On Thursday, 11 August 2022 at 22:34:11 UTC, realhet wrote: On Thursday, 11 August 2022 at 19:33:31 UTC, bachmeier wrote: std.string does a public import of std.algorithm.cmp. That was it! Thanks! Conclusion: This is how to overload cmp() A search of the forum suggests [this is how I learne