mysql-native Help required

2020-10-22 Thread Vino via Digitalmars-d-learn
Hi All, Request your help on the below code as it is not working as expected. GetConnections.d module common.GetConnections; import mysql; class Connections { private Connection conn; auto constr = "host=localhost;port=3910;user=user;pwd=password#;db=testdb"; this.conn = new

Re: More elaborate asserts in unittests?

2020-10-22 Thread MoonlightSentinel via Digitalmars-d-learn
On Thursday, 22 October 2020 at 04:20:35 UTC, Mathias LANG wrote: Unfortunately this switch still has some bugs, so you can easily run into linker errors. I'm hoping to ultimately make it the default though. Which is more of a template emission problem because `-checkaction=context` uses a

Re: is type checking in D undecidable?

2020-10-22 Thread Bruce Carneal via Digitalmars-d-learn
On Friday, 23 October 2020 at 04:24:09 UTC, Paul Backus wrote: On Friday, 23 October 2020 at 00:53:19 UTC, Bruce Carneal wrote: When you write functions, the compiler helps you out with fully automated constraint checking. When you write templates you can write them so that they look like

Re: is type checking in D undecidable?

2020-10-22 Thread Paul Backus via Digitalmars-d-learn
On Friday, 23 October 2020 at 00:53:19 UTC, Bruce Carneal wrote: When you write functions, the compiler helps you out with fully automated constraint checking. When you write templates you can write them so that they look like simple functions, in which case you're on pretty solid ground.

Re: mysql-native Help required

2020-10-22 Thread novice3 via Digitalmars-d-learn
On Thursday, 22 October 2020 at 11:04:53 UTC, Vino wrote: class Connections { private Connection conn; auto constr = "host=localhost;port=3910;user=user;pwd=password#;db=testdb"; this.conn = new Connection(constr); } where Connections class constructor implemented?

Re: Recommended way to use __FILE__/__LINE__ etc.

2020-10-22 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 22 October 2020 at 16:03:45 UTC, H. S. Teoh wrote: On Thu, Oct 22, 2020 at 03:32:57PM +, Andrey Zherikov via Digitalmars-d-learn wrote: There are two ways how __FILE__, __LINE__ etc. can se used in function parameters: as regular parameters and as template parameters: [...]

Re: mysql-native Help required

2020-10-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/22/20 7:04 AM, Vino wrote: Hi All,   Request your help on the below code as it is not working as expected. GetConnections.d module common.GetConnections; import mysql; class Connections {   private Connection conn;   auto constr =

Re: mysql-native Help required

2020-10-22 Thread Vino via Digitalmars-d-learn
On Thursday, 22 October 2020 at 14:08:30 UTC, Steven Schveighoffer wrote: On 10/22/20 7:04 AM, Vino wrote: Hi All,   Request your help on the below code as it is not working as expected. GetConnections.d module common.GetConnections; import mysql; class Connections {   private

Recommended way to use __FILE__/__LINE__ etc.

2020-10-22 Thread Andrey Zherikov via Digitalmars-d-learn
There are two ways how __FILE__, __LINE__ etc. can se used in function parameters: as regular parameters and as template parameters: void rt(string file=__FILE__, int line=__LINE__, string func=__FUNCTION__) { writeln(file,"(",line,"): ",func); } void ct(string file=__FILE__, int

Re: Recommended way to use __FILE__/__LINE__ etc.

2020-10-22 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Oct 22, 2020 at 03:32:57PM +, Andrey Zherikov via Digitalmars-d-learn wrote: > There are two ways how __FILE__, __LINE__ etc. can se used in function > parameters: as regular parameters and as template parameters: [...] > What is recommended way? > What are pros/cons of each case? I

is type checking in D undecidable?

2020-10-22 Thread Bruce Carneal via Digitalmars-d-learn
Is type checking in D undecidable? Per the wiki on dependent types it sure looks like it is. I assume that it's well known to the compiler contributors that D type checking is undecidable which, among other reasons, is why we have things like template recursion limits. Confirmation of the

Re: is type checking in D undecidable?

2020-10-22 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Thursday, 22 October 2020 at 18:24:47 UTC, Bruce Carneal wrote: Per the wiki on termination analysis some languages with dependent types (Agda, Coq) have built-in termination checkers. I assume that DMD employs something short of such a checker, some combination of cycle detection backed up

Re: is type checking in D undecidable?

2020-10-22 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 22 October 2020 at 18:33:52 UTC, Ola Fosheim Grøstad wrote: In general, it is hard to tell if a computation is long-running or unsolvable. You could even say ... it's undecidable :)

Re: is type checking in D undecidable?

2020-10-22 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Thursday, 22 October 2020 at 17:25:44 UTC, Bruce Carneal wrote: Is type checking in D undecidable? Per the wiki on dependent types it sure looks like it is. Even if it is, you can still write something that is decidable in D, but impractical in terms of compile time. You probably mean

Re: is type checking in D undecidable?

2020-10-22 Thread Bruce Carneal via Digitalmars-d-learn
On Thursday, 22 October 2020 at 18:04:32 UTC, Ola Fosheim Grøstad wrote: On Thursday, 22 October 2020 at 17:25:44 UTC, Bruce Carneal wrote: Is type checking in D undecidable? Per the wiki on dependent types it sure looks like it is. Even if it is, you can still write something that is

Re: is type checking in D undecidable?

2020-10-22 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Thursday, 22 October 2020 at 18:38:12 UTC, Stefan Koch wrote: On Thursday, 22 October 2020 at 18:33:52 UTC, Ola Fosheim Grøstad wrote: In general, it is hard to tell if a computation is long-running or unsolvable. You could even say ... it's undecidable :) :-) Yes, although you can

Re: is type checking in D undecidable?

2020-10-22 Thread Dennis via Digitalmars-d-learn
On Thursday, 22 October 2020 at 17:25:44 UTC, Bruce Carneal wrote: Is type checking in D undecidable? Per the wiki on dependent types it sure looks like it is. It is indeed undecidable. Imagine you had a decider for it. Because CTFE is clearly turing-complete, you can express that in a D

Re: mysql-native Help required

2020-10-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/22/20 11:00 AM, Vino wrote: On Thursday, 22 October 2020 at 14:08:30 UTC, Steven Schveighoffer wrote: On 10/22/20 7:04 AM, Vino wrote: Hi All,    Request your help on the below code as it is not working as expected. GetConnections.d module common.GetConnections; import mysql; class

Re: is type checking in D undecidable?

2020-10-22 Thread Bruce Carneal via Digitalmars-d-learn
On Thursday, 22 October 2020 at 18:46:07 UTC, Ola Fosheim Grøstad wrote: On Thursday, 22 October 2020 at 18:38:12 UTC, Stefan Koch wrote: On Thursday, 22 October 2020 at 18:33:52 UTC, Ola Fosheim Grøstad wrote: In general, it is hard to tell if a computation is long-running or unsolvable.

Re: is type checking in D undecidable?

2020-10-22 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 22 October 2020 at 19:24:53 UTC, Bruce Carneal wrote: On a related topic, I believe that type functions enable a large amount of code in the "may be hard to prove decidable" category (templates) to be (re)written as clearly decidable code. Easier for the compiler to deal with

Re: Recommended way to use __FILE__/__LINE__ etc.

2020-10-22 Thread Andrey Zherikov via Digitalmars-d-learn
Thanks for all your answers!

Re: is type checking in D undecidable?

2020-10-22 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Thursday, 22 October 2020 at 19:24:53 UTC, Bruce Carneal wrote: I dont think it is any easier to prove the "will increase faster" proposition than it is to prove the whole thing. They probably just impose restrictions so that they prove that there is reduction and progress over time. One

static alias this and if/do/while/for

2020-10-22 Thread Jack Applegame via Digitalmars-d-learn
There is a funny feature (or bug) in the D language: static alias this and static operator overloading. For example interface Foo { static { int value; void opAssign(int v) { value = v; } int get() { return value; } alias get this; } } Now we can use

Re: is type checking in D undecidable?

2020-10-22 Thread Bruce Carneal via Digitalmars-d-learn
On Thursday, 22 October 2020 at 20:37:22 UTC, Paul Backus wrote: On Thursday, 22 October 2020 at 19:24:53 UTC, Bruce Carneal wrote: On a related topic, I believe that type functions enable a large amount of code in the "may be hard to prove decidable" category (templates) to be (re)written as