Re: Disabling opAssign in a type disabled all the opAssigns of an aliased type?

2018-07-31 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 30 July 2018 at 23:41:09 UTC, aliak wrote: https://issues.dlang.org/show_bug.cgi?id=19130 Beautiful. :) Would it take much to fix it up to use with templated opAssigns as well? I spent half an hour doing silly things, then I came up with this: struct A { void opAssign(int) {

Re: Disabling opAssign in a type disabled all the opAssigns of an aliased type?

2018-07-31 Thread Simen Kjærås via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 07:01:33 UTC, Simen Kjærås wrote: auto opAssign(T...)(T args) Admittedly, one rarely uses multi-argument opAssign, but for those rare occasions... :p -- Simen

Re: append uninitialized elements to array

2018-07-31 Thread realhet via Digitalmars-d-learn
Thank You!

Why does not UFCS work for method defined inside unittest block?

2018-07-31 Thread Ky-Anh Huynh via Digitalmars-d-learn
Hi, Can I define a new quick function to use inside a unittest block? I have the following code: [code] auto foo(string[] sta) { return sta; } auto bar(string[] sta) { return sta; } auto h(string[] sta) { return sta.foo.bar; } unittest { import std.format; auto f = (string[] sta)

Re: Why does not UFCS work for method defined inside unittest block?

2018-07-31 Thread Ky-Anh Huynh via Digitalmars-d-learn
dmd version that I'm using: $ dmd --version DMD64 D Compiler v2.081.1-dirty Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright

Re: Why does not UFCS work for method defined inside unittest block?

2018-07-31 Thread Simen Kjærås via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 08:28:01 UTC, Ky-Anh Huynh wrote: Hi, Can I define a new quick function to use inside a unittest block? I have the following code: [code] auto foo(string[] sta) { return sta; } auto bar(string[] sta) { return sta; } auto h(string[] sta) { return sta.foo.ba

Re: A vibe.d thing

2018-07-31 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-07-27 21:02, Russel Winder wrote: I have posted to the vibe.d forum, but I hate forums, FYI, it's possible to access the vibe.d forum through a news reader by using the following URL [1]. This is noted at the bottom of the forum [2]. [1] nntp://forum.rejectedsoftware.com/ [2] http://

Re: How to best implement a DSL?

2018-07-31 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-07-28 16:59, Robert M. Münch wrote: Hi, I'm seeking for ideas/comments/experiences how to best implement a DSL in D. What I would like to do is something like this: ... my D code ... my-dsl { ... my multi-line DSL code ... trade 100 shares(x) when (time < 20

Re: A vibe.d thing

2018-07-31 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Jul 27, 2018 at 9:30 PM Steven Schveighoffer via Digitalmars-d-learn wrote: > > > > Maybe IOMode.immediate or .once? > > https://vibed.org/api/eventcore.driver/IOMode > > Oh, it looks like you specified once. Hm... that seems to me like it > should work. > > Looks like IOMode is ignored:

Re: A vibe.d thing

2018-07-31 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2018-07-31 at 13:10 +0200, Daniel Kozak via Digitalmars-d-learn wrote: > On Fri, Jul 27, 2018 at 9:30 PM Steven Schveighoffer via > Digitalmars-d-learn wrote: > > > > > > > Maybe IOMode.immediate or .once? > > > https://vibed.org/api/eventcore.driver/IOMode > > > > Oh, it looks like you

Re: append uninitialized elements to array

2018-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/30/18 5:10 PM, Ali Çehreli wrote: On 07/30/2018 10:40 AM, realhet wrote: Hello, I've already found out how to create an array with uninitialized elements, but what I'm looking for is a way to append 16 uninitialized ushorts to it and after I will it directly from 2 SSE registers. The a

Re: How to get an inout constructor working with a template wrapper

2018-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/29/18 1:46 PM, aliak wrote: On Sunday, 29 July 2018 at 12:45:48 UTC, Steven Schveighoffer wrote: Am I applying inout incorrectly? No, you need to apply it to wrap as well. I can't get run.dlang.io to work for posting a link, so here is my modified version: Ah bugger, right! Ok so t

Re: A vibe.d thing

2018-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/31/18 7:49 AM, Russel Winder wrote: On Tue, 2018-07-31 at 13:10 +0200, Daniel Kozak via Digitalmars-d-learn wrote: On Fri, Jul 27, 2018 at 9:30 PM Steven Schveighoffer via Digitalmars-d-learn wrote: Maybe IOMode.immediate or .once? https://vibed.org/api/eventcore.driver/IOMode Oh, it

Linking to dynamic druntime with dub

2018-07-31 Thread Nicholas Wilson via Digitalmars-d-learn
My application needs to load shared libraries: on Posix this is only supported with a shared druntime. How does one link to the dynamic druntime with dub?

Re: Linking to dynamic druntime with dub

2018-07-31 Thread rikki cattermole via Digitalmars-d-learn
On 01/08/2018 1:43 AM, Nicholas Wilson wrote: My application needs to load shared libraries: on Posix this is only supported with a shared druntime. How does one link to the dynamic druntime with dub? The same way you do it without dub. Except you pass the flags inside of "dflags".

Re: Linking to dynamic druntime with dub

2018-07-31 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 13:52:21 UTC, rikki cattermole wrote: On 01/08/2018 1:43 AM, Nicholas Wilson wrote: My application needs to load shared libraries: on Posix this is only supported with a shared druntime. How does one link to the dynamic druntime with dub? The same way you do it wit

Re: Linking to dynamic druntime with dub

2018-07-31 Thread rikki cattermole via Digitalmars-d-learn
On 01/08/2018 2:18 AM, Nicholas Wilson wrote: On Tuesday, 31 July 2018 at 13:52:21 UTC, rikki cattermole wrote: On 01/08/2018 1:43 AM, Nicholas Wilson wrote: My application needs to load shared libraries: on Posix this is only supported with a shared druntime. How does one link to the dynamic

Small program producing binary with large filesize

2018-07-31 Thread Dan Barbarito via Digitalmars-d-learn
Hi all, I am starting to write a command line tool. So far it is a small (feature-wise) program but the file size is scaring me. It's already 13 megabytes, but I would expect it to be much smaller. Is it because I'm using 3 libraries so far? The libraries are: mir, vibe.d, and d2sqlite3. Woul

Re: A vibe.d thing

2018-07-31 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2018-07-31 at 08:39 -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > […] > Hm.. it appears that there is a timeout exception thrown if there is > no > data within a certain time period. Are you getting that instead? To be honest, I am not sure. From a "I haven't looked at the

Re: A vibe.d thing

2018-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/31/18 11:20 AM, Russel Winder wrote: On Tue, 2018-07-31 at 08:39 -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: […] Hm.. it appears that there is a timeout exception thrown if there is no data within a certain time period. Are you getting that instead? To be honest, I am no

Re: Where is TypeInfo_Class.m_init set

2018-07-31 Thread Hakan Aras via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 03:42:15 UTC, Mike Franklin wrote: I would also like to be able to use `extern(C++)` classes without the runtime, but I haven't been able to allocate any time to it yet. If you're trying to use `extern(C++)` classes with betterC, and the compiler is complaining ab

Re: A vibe.d thing

2018-07-31 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2018-07-31 at 11:54 -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > […] > > Understandable. I actually don't think you ever posted the real > message > that comes out, just a link to the source code, from which I found > it > wasn't obeying the mode variable. > > But now, i

Re: Where is TypeInfo_Class.m_init set

2018-07-31 Thread kinke via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 01:16:29 UTC, Hakan Aras wrote: I was hoping it would be possible without tinkering with the compiler, but it doesn't seem to be the case. I've been playing around with LDC. There is an init symbol for classes, which is normally used as payload for the ClassInfo's

Re: A vibe.d thing

2018-07-31 Thread Russel Winder via Digitalmars-d-learn
I have posted issue 2194 on the Vibe.d GitHub issues. https://github.com/vibe-d/vibe.d/issues/2194 -- Russel. === Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.as

Re: A vibe.d thing

2018-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/31/18 1:22 PM, Russel Winder wrote: I have posted issue 2194 on the Vibe.d GitHub issues. https://github.com/vibe-d/vibe.d/issues/2194 Thanks, that should be good enough to figure out the bug in either your code or vibe.d -Steve

Re: Small program producing binary with large filesize

2018-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/31/18 11:19 AM, Dan Barbarito wrote: Hi all, I am starting to write a command line tool. So far it is a small (feature-wise) program but the file size is scaring me. It's already 13 megabytes, but I would expect it to be much smaller. Is it because I'm using 3 libraries so far? The libra

Re: Disabling opAssign in a type disabled all the opAssigns of an aliased type?

2018-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/30/18 2:30 PM, aliak wrote: Is this a bug? If not is there a workaround? I would like for the alias this to function as a normal A type unless B specifically disables certain features, but it seems weird that disabling one opAssign disables all of them inside the aliases type but not in

Re: Where is TypeInfo_Class.m_init set

2018-07-31 Thread kinke via Digitalmars-d-learn
Sorry, scratch that, I forgot the `extern` before the dummy global. After fixing that, I didn't quickly find a solution for referencing the symbol in the .data.rel.ro section (LLVM asm, e.g., `void* getInit() { return __asm!(void*)("movq test.C.__init, %rax", "={rax}"); }` doesn't work either).

Re: Small program producing binary with large filesize

2018-07-31 Thread Seb via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 15:19:19 UTC, Dan Barbarito wrote: Hi all, I am starting to write a command line tool. So far it is a small (feature-wise) program but the file size is scaring me. It's already 13 megabytes, but I would expect it to be much smaller. Is it because I'm using 3 librar

Re: How to get an inout constructor working with a template wrapper

2018-07-31 Thread aliak via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 12:37:34 UTC, Steven Schveighoffer wrote: On 7/29/18 1:46 PM, aliak wrote: On Sunday, 29 July 2018 at 12:45:48 UTC, Steven Schveighoffer wrote: Am I applying inout incorrectly? No, you need to apply it to wrap as well. I can't get run.dlang.io to work for posting

Re: How to get an inout constructor working with a template wrapper

2018-07-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/31/18 5:29 PM, aliak wrote: On Tuesday, 31 July 2018 at 12:37:34 UTC, Steven Schveighoffer wrote: On 7/29/18 1:46 PM, aliak wrote: On Sunday, 29 July 2018 at 12:45:48 UTC, Steven Schveighoffer wrote: Am I applying inout incorrectly? No, you need to apply it to wrap as well. I can't get

Re: How to get an inout constructor working with a template wrapper

2018-07-31 Thread aliak via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 21:54:54 UTC, Steven Schveighoffer wrote: Because inout is trying to combine all mutability modifiers into one. You want to specify the type, not the mutability, in the template parameter T. Ahhh. Ok I see... I think. This doesn't make sense. Can you post runnable

Re: Linking to dynamic druntime with dub

2018-07-31 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 14:27:18 UTC, rikki cattermole wrote: On 01/08/2018 2:18 AM, Nicholas Wilson wrote: On Tuesday, 31 July 2018 at 13:52:21 UTC, rikki cattermole wrote: On 01/08/2018 1:43 AM, Nicholas Wilson wrote: My application needs to load shared libraries: on Posix this is only s

Re: Disabling opAssign in a type disabled all the opAssigns of an aliased type?

2018-07-31 Thread Simen Kjærås via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 20:40:25 UTC, Steven Schveighoffer wrote: OK, so one thing to learn in D, you can't hijack stuff. When you override a function, you have to override ALL the overloads. I could have sworn I tested this before I wrote that it's a bug: struct A { void fun(int) {} }