Re: opCast cannot implicitly convert a.opCast of type X to Y

2018-02-13 Thread Nathan S. via Digitalmars-d-learn
On Monday, 12 February 2018 at 02:05:16 UTC, aliak wrote: struct B(T) { T t; } struct A(T) { T t; auto opCast(U)() { return B!U(cast(U)t); } } void main() { auto a = A!int(3); auto b = cast(float)a; // error } Having the result of "cast(float) a" not be a

Re: unable to fork: Cannot allocate memory / core.checkedint / gtkd

2018-02-13 Thread number via Digitalmars-d-learn
On Sunday, 11 February 2018 at 15:05:26 UTC, number wrote: On Sunday, 11 February 2018 at 13:17:13 UTC, number wrote: unable to fork: Cannot allocate memory if i comment-out the line.. writeln(GdkKeysyms.GDK_Escape); then it compiles/links/runs fine. I just tried again. compiling the

Re: unable to fork: Cannot allocate memory / core.checkedint / gtkd

2018-02-13 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 12:17:31 UTC, number wrote: On Sunday, 11 February 2018 at 15:05:26 UTC, number wrote: On Sunday, 11 February 2018 at 13:17:13 UTC, number wrote: unable to fork: Cannot allocate memory if i comment-out the line.. writeln(GdkKeysyms.GDK_Escape); then it

import strangeness with std.stdio.write

2018-02-13 Thread psychoticRabbit via Digitalmars-d-learn
So, strange problem below. The commented-out line will not compile (if I un-comment it), unless I either move std.stdio into main, or, move std.file out of main. Whereas writeln works just fine as is. - module test; import std.stdio; void main() { import std.file;

Re: import strangeness with std.stdio.write

2018-02-13 Thread psychoticRabbit via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 13:46:11 UTC, psychoticRabbit wrote: So, strange problem below. The commented-out line will not compile (if I un-comment it), unless I either move std.stdio into main, or, move std.file out of main. Whereas writeln works just fine as is.

Re: import strangeness with std.stdio.write

2018-02-13 Thread rikki cattermole via Digitalmars-d-learn
On 13/02/2018 1:46 PM, psychoticRabbit wrote: So, strange problem below. The commented-out line will not compile (if I un-comment it), unless I either move std.stdio into main, or, move std.file out of main. Whereas writeln works just fine as is. - module test; import

Re: import strangeness with std.stdio.write

2018-02-13 Thread ketmar via Digitalmars-d-learn
psychoticRabbit wrote: So, strange problem below. The commented-out line will not compile (if I un-comment it), unless I either move std.stdio into main, or, move std.file out of main. Whereas writeln works just fine as is. - module test; import std.stdio; void main()

Re: import strangeness with std.stdio.write

2018-02-13 Thread psychoticRabbit via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 13:52:37 UTC, rikki cattermole wrote: On 13/02/2018 1:46 PM, psychoticRabbit wrote: So, strange problem below. The commented-out line will not compile (if I un-comment it), unless I either move std.stdio into main, or, move std.file out of main. Whereas

Re: No error message in DMD 2.078.2

2018-02-13 Thread ag0aep6g via Digitalmars-d-learn
On 02/13/2018 06:51 AM, Domain wrote: module main; void main () {     writeln("Hello"); } Of course, this won't compile, but error message is confused: C:\Git\hello\source>dmd app.d app.d(5): Error: object.Error@(0): Access Violation This is issue 18403. You should see an error message

Re: import strangeness with std.stdio.write

2018-02-13 Thread psychoticRabbit via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 14:18:05 UTC, ketmar wrote: psychoticRabbit wrote: Also, if I do this below, how does the compiler choose the correct write function? import std.stdio; import std.file; void main() { write("hello"); writeln("hello again"); } it's easy: just take a

Re: import strangeness with std.stdio.write

2018-02-13 Thread bauss via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 13:56:17 UTC, psychoticRabbit wrote: On Tuesday, 13 February 2018 at 13:52:37 UTC, rikki cattermole wrote: On 13/02/2018 1:46 PM, psychoticRabbit wrote: So, strange problem below. The commented-out line will not compile (if I un-comment it), unless I either

Re: unable to fork: Cannot allocate memory / core.checkedint / gtkd

2018-02-13 Thread number via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 12:32:58 UTC, Stefan Koch wrote: On Tuesday, 13 February 2018 at 12:17:31 UTC, number wrote: I just tried again. compiling the following code eats up my 4GB of RAM and fails. Please copy the enumeration from:

Re: import strangeness with std.stdio.write

2018-02-13 Thread ketmar via Digitalmars-d-learn
psychoticRabbit wrote: Also, if I do this below, how does the compiler choose the correct write function? import std.stdio; import std.file; void main() { write("hello"); writeln("hello again"); } it's easy: just take a look at `std.file.write()`. first, it require two

Re: import strangeness with std.stdio.write

2018-02-13 Thread psychoticRabbit via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 13:57:38 UTC, ketmar wrote: `std.file` has function named `write()` too. and local import completely shadows global imports (i.e. it removes global imports from overload set for the given scope), hence `std.stdio.write()` is not available there. "..local

Re: import strangeness with std.stdio.write

2018-02-13 Thread psychoticRabbit via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 14:21:31 UTC, bauss wrote: What you can do is use aliases to use both functions. import io = std.stdio; void main() { import file = std.file; file.write("hello"); io.writeln("hello again"); } that's a nice simple solution. thanks.

Re: inout question

2018-02-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/12/18 12:33 AM, Norm wrote: Hi, I'm new to D so can someone explain to me what is happening here? void func(const char* s, char** e) {     import core.stdc.stdlib;     auto result = strtod(s, e); } Error: function core.stdc.stdlib.strtod (scope inout(char)* nptr, scope inout(char)**

Re: dpq2: spurious error message

2018-02-13 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 17:08:24 UTC, Nicholas Wilson wrote: Is this a problem with the library or me? Can I work around it? How? Thanks Nic So digging around in the library code, commenting it out seems to work for now as I don't use UUIDs. Error didn't originate from my code

dpq2: spurious error message

2018-02-13 Thread Nicholas Wilson via Digitalmars-d-learn
import vibe.vibe; import vibe.db.postgresql; QueryParams p; p.sqlCommand = "select title,url,url_title,messagebody,generationtime from items order by generationtime;"; auto _items = conn.execParams(p); struct Range { immutable Answer a; size_t i; immutable(Row) front() {

Re: rmdirRecurse - on NFS file system

2018-02-13 Thread Vino via Digitalmars-d-learn
On Monday, 12 February 2018 at 06:52:25 UTC, Vino wrote: Hi All, Request your help, the below code works find on normal File system, bu if the file system is a NFS file system the below code, is not working if Step = dryrun( Display Only) : Works for both NFS and normal file system. if

Re: dpq2: spurious error message

2018-02-13 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 17:17:41 UTC, Nicholas Wilson wrote: On Tuesday, 13 February 2018 at 17:08:24 UTC, Nicholas Wilson wrote: Is this a problem with the library or me? Can I work around it? How? Thanks Nic So digging around in the library code, commenting it out seems to work

Re: import strangeness with std.stdio.write

2018-02-13 Thread ixid via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 13:52:37 UTC, rikki cattermole wrote: write exists in both, writeln exists only in std.stdio. Use named imports to pick which write you want. It does seem a little silly to have a name clash with such a commonly used function. Would it not be better to rename

Re: import strangeness with std.stdio.write

2018-02-13 Thread Seb via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 16:55:10 UTC, ixid wrote: On Tuesday, 13 February 2018 at 13:52:37 UTC, rikki cattermole wrote: write exists in both, writeln exists only in std.stdio. Use named imports to pick which write you want. It does seem a little silly to have a name clash with such a

Re: rmdirRecurse - on NFS file system

2018-02-13 Thread Seb via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 16:58:09 UTC, Vino wrote: On Monday, 12 February 2018 at 06:52:25 UTC, Vino wrote: [...] Hi All, Was able to resolve this issue. That's great! BTW I think it would be helpful for future reader who find this thread to know how you resolved your problem.

Re: opCast cannot implicitly convert a.opCast of type X to Y

2018-02-13 Thread aliak via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 12:12:30 UTC, Nathan S. wrote: On Monday, 12 February 2018 at 02:05:16 UTC, aliak wrote: struct B(T) { T t; } struct A(T) { T t; auto opCast(U)() { return B!U(cast(U)t); } } void main() { auto a = A!int(3); auto b = cast(float)a;

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-13 Thread Jordi Sayol via Digitalmars-d-learn
El 13/02/18 a les 08:03, Martin Tschierschke via Digitalmars-d-learn ha escrit: > On Monday, 12 February 2018 at 21:18:01 UTC, Jordi Sayol wrote: >> El 12/02/18 a les 21:56, Martin Tschierschke via Digitalmars-d-learn ha >> escrit: >>> I just started to play around with D again on my notebook at

Re: unable to fork: Cannot allocate memory / core.checkedint / gtkd

2018-02-13 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 14:10:44 UTC, number wrote: Ok, thanks for the info. I guess I'll just use printf then for larger enums. To get the same convince you can use. the enumToString from: https://forum.dlang.org/post/pnggoabnnkojdonyz...@forum.dlang.org and writeln the result oft

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-13 Thread Martin Tschierschke via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 21:25:44 UTC, Jordi Sayol wrote: El 13/02/18 a les 08:03, Martin Tschierschke via Digitalmars-d-learn ha escrit: On Monday, 12 February 2018 at 21:18:01 UTC, Jordi Sayol wrote: El 12/02/18 a les 21:56, Martin Tschierschke via Digitalmars-d-learn ha escrit: I

Re: rmdirRecurse - on NFS file system

2018-02-13 Thread Vino via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 17:01:06 UTC, Seb wrote: On Tuesday, 13 February 2018 at 16:58:09 UTC, Vino wrote: On Monday, 12 February 2018 at 06:52:25 UTC, Vino wrote: [...] Hi All, Was able to resolve this issue. That's great! BTW I think it would be helpful for future reader who