Re: Bug or case of hijacking protection ?

2016-10-17 Thread Basile B. via Digitalmars-d-learn
On Monday, 17 October 2016 at 14:01:26 UTC, Basile B. wrote: Is this a bug or a case of hijacking protection ? struct S { void test(void*, size_t){} } void test(ref S,void[]){} void main() { ubyte[] a; (*new S).test(a); } ¨¨

Bug or case of hijacking protection ?

2016-10-17 Thread Basile B. via Digitalmars-d-learn
Is this a bug or a case of hijacking protection ? struct S { void test(void*, size_t){} } void test(ref S,void[]){} void main() { ubyte[] a; (*new S).test(a); }

Re: Determining if a class has a template function

2016-10-12 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 11 October 2016 at 20:17:19 UTC, Straivers wrote: I have a class T with a templated function foo(string name)(int, int, float) that will be mixed in via template, and I want to determine if that class has mixed it in such that foo(name = "bar"). How could I go about this? Thanks.

Re: obscure messages relating to linking and imports in 2.071.1

2016-10-05 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 12:12:24 UTC, Basile B. wrote: On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc wrote: I noticed the problem before - previously it was my fault. I had a circulator dependency where A imported B, B did a selective import of C and C imported A selectiv

Re: obscure messages relating to linking and imports in 2.071.1

2016-10-05 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc wrote: I noticed the problem before - previously it was my fault. I had a circulator dependency where A imported B, B did a selective import of C and C imported A selectively. That led to link problems with module constructors. [..

Re: Class attributes

2016-10-02 Thread Basile B. via Digitalmars-d-learn
On Sunday, 2 October 2016 at 15:54:38 UTC, Satoshi wrote: Hello, why pure @safe nothrow @nogc struct Point { } isn't same as struct Point { pure: @safe: nothrow: @nogc: } ?? This is not specified but attributes aren't applied to the scope created by the declaration. Which is a good thing,

Re: Is there any way to have [] overloads use compile-time indexes as is currently done for Tuples?

2016-09-27 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 27 September 2016 at 09:21:04 UTC, pineapple wrote: I'd really like to define my own types that accept indexes for opIndex and opSlice as template arguments. Is there any way to do this? If not, this seems like an obvious thing to add to the language - what's been holding it back?

Re: how to access struct member using [] operator?

2016-09-25 Thread Basile B. via Digitalmars-d-learn
On Sunday, 25 September 2016 at 16:26:11 UTC, Basile B. wrote: On Sunday, 25 September 2016 at 16:07:59 UTC, Basile B. wrote: On Sunday, 25 September 2016 at 09:01:44 UTC, Namespace wrote: On Sunday, 25 September 2016 at 04:54:31 UTC, grampus wrote: Dear all For example, I have a struct struc

Re: how to access struct member using [] operator?

2016-09-25 Thread Basile B. via Digitalmars-d-learn
On Sunday, 25 September 2016 at 16:07:59 UTC, Basile B. wrote: On Sunday, 25 September 2016 at 09:01:44 UTC, Namespace wrote: On Sunday, 25 September 2016 at 04:54:31 UTC, grampus wrote: Dear all For example, I have a struct struct point{int x;int y} point a; Is there an easy way to access x

Re: how to access struct member using [] operator?

2016-09-25 Thread Basile B. via Digitalmars-d-learn
On Sunday, 25 September 2016 at 09:01:44 UTC, Namespace wrote: On Sunday, 25 September 2016 at 04:54:31 UTC, grampus wrote: Dear all For example, I have a struct struct point{int x;int y} point a; Is there an easy way to access x and y by using a["x"] and a["y"] I guess I need to overload [

Re: how to access struct member using [] operator?

2016-09-25 Thread Basile B. via Digitalmars-d-learn
On Sunday, 25 September 2016 at 04:54:31 UTC, grampus wrote: Dear all For example, I have a struct struct point{int x;int y} point a; Is there an easy way to access x and y by using a["x"] and a["y"] I guess I need to overload [], but can't figure out how. Someone can help? Thank you very m

Re: Lazily evaluated property pointing to read only object

2016-09-24 Thread Basile B. via Digitalmars-d-learn
On Saturday, 24 September 2016 at 10:59:50 UTC, mikey wrote: On Saturday, 24 September 2016 at 10:16:34 UTC, Basile B. wrote: You don't need to cast, from "mutable" to "const" is implicit: https://dlang.org/spec/const3.html#implicit_conversions Ok, but using const would be an accepted way of d

Re: Lazily evaluated property pointing to read only object

2016-09-24 Thread Basile B. via Digitalmars-d-learn
On Saturday, 24 September 2016 at 09:08:52 UTC, mikey wrote: I'm trying to figure out how to best write a class with a property that is only evaluated when it's called for the first time. And that returns an object which shouldn't be modifiable a part of the owning class. I've had a go at doi

Re: D and math, can you isolate this ?

2016-09-21 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 12:35:18 UTC, Basile B. wrote: The problem is here: https://github.com/BBasile/iz/blob/master/import/iz/math.d#L849 - f(x,c) = 1.0 - pow(1.0 - pow(x, 2.0/c), c * 0.5); - c(f0.5)) = ? Which means that I ask you if you can isolate c for y = 1.0 - pow(1.0 - pow(0.5

Re: D and math, can you isolate this ?

2016-09-21 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 01:34:06 UTC, Nicholas Wilson wrote: On Tuesday, 20 September 2016 at 12:35:18 UTC, Basile B. wrote: I've recently started an easing/interpolation family of function in my D user library. It's based on something I know well since I've already used them in 2012

Re: D and math, can you isolate this ?

2016-09-20 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 16:22:19 UTC, H. S. Teoh wrote: On Tue, Sep 20, 2016 at 12:35:18PM +, Basile B. via Digitalmars-d-learn wrote: [...] The problem is here: https://github.com/BBasile/iz/blob/master/import/iz/math.d#L849 - f(x,c) = 1.0 - pow(1.0 - pow(x, 2.0/c), c * 0.5); - c

Re: D and math, can you isolate this ?

2016-09-20 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 12:35:18 UTC, Basile B. wrote: I've recently started an easing/interpolation family of function in my D user library. It's based on something I know well since I've already used them in 2012 in a VST plugin called GrainPlot (RIP). However for one of the functi

D and math, can you isolate this ?

2016-09-20 Thread Basile B. via Digitalmars-d-learn
I've recently started an easing/interpolation family of function in my D user library. It's based on something I know well since I've already used them in 2012 in a VST plugin called GrainPlot (RIP). However for one of the function, I can't manage to get the inverse. A function that's fully

Re: GDB, cant break on _d_throwc anymore !

2016-09-18 Thread Basile B. via Digitalmars-d-learn
On Sunday, 18 September 2016 at 15:40:09 UTC, Basile B. wrote: Hello, I'm sure it was working last time I've tried (I can't say when, maybe > 6 months). I'm on linux x86_64, GDB 7.8 If I send to GDB "break _d_assert" it will break correctly on "assert(false);" so I can jump over. But the equiv

Re: GDB, cant break on _d_throwc anymore !

2016-09-18 Thread Basile B. via Digitalmars-d-learn
On Sunday, 18 September 2016 at 15:48:27 UTC, Basile B. wrote: On Sunday, 18 September 2016 at 15:40:55 UTC, Guillaume Piolat wrote: On Sunday, 18 September 2016 at 15:40:09 UTC, Basile B. wrote: Hello, I'm sure it was working last time I've tried (I can't say when, maybe > 6 months). I'm on li

Re: GDB, cant break on _d_throwc anymore !

2016-09-18 Thread Basile B. via Digitalmars-d-learn
On Sunday, 18 September 2016 at 15:48:27 UTC, Basile B. wrote: On Sunday, 18 September 2016 at 15:40:55 UTC, Guillaume Piolat wrote: On Sunday, 18 September 2016 at 15:40:09 UTC, Basile B. wrote: Hello, I'm sure it was working last time I've tried (I can't say when, maybe > 6 months). I'm on li

Re: GDB, cant break on _d_throwc anymore !

2016-09-18 Thread Basile B. via Digitalmars-d-learn
On Sunday, 18 September 2016 at 15:40:55 UTC, Guillaume Piolat wrote: On Sunday, 18 September 2016 at 15:40:09 UTC, Basile B. wrote: Hello, I'm sure it was working last time I've tried (I can't say when, maybe > 6 months). I'm on linux x86_64, GDB 7.8 If I send to GDB "break _d_assert" it will

GDB, cant break on _d_throwc anymore !

2016-09-18 Thread Basile B. via Digitalmars-d-learn
Hello, I'm sure it was working last time I've tried (I can't say when, maybe > 6 months). I'm on linux x86_64, GDB 7.8 If I send to GDB "break _d_assert" it will break correctly on "assert(false);" so I can jump over. But the equivalent for _d_throwc doesn't work anymore ! Any idea ?

Re: Discarding all forum drafts at once

2016-09-13 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 18:15:56 UTC, Nordlöw wrote: I have lots of unsent drafts I would like to discard all at once. Is this possible somehow? Delete the cookies.

Re: Copy a struct and its context

2016-09-13 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 01:32:19 UTC, Steven Schveighoffer wrote: On 9/12/16 4:11 PM, Ali Çehreli wrote: On 09/10/2016 10:44 PM, Yuxuan Shui wrote: I recently noticed nested struct capture its context by reference (which, BTW, is not mentioned at all here: https://dlang.org/spec/struc

Re: iasm, unexpectedly slower than DMD production

2016-09-12 Thread Basile B. via Digitalmars-d-learn
On Monday, 12 September 2016 at 00:46:16 UTC, Basile B. wrote: I have this function, written in iasm: ° T foo(T)(T x, T c) if (is(T == float) || is(T == double)) { version(none) { return x*x*x - x*x*c + x*c; } else asm {

iasm, unexpectedly slower than DMD production

2016-09-11 Thread Basile B. via Digitalmars-d-learn
I have this function, written in iasm: ° T foo(T)(T x, T c) if (is(T == float) || is(T == double)) { version(none) { return x*x*x - x*x*c + x*c; } else asm { naked; movsd XMM3, XMM1; mulsd XMM0, XMM1;

Re: Reading hexidecimal from a file

2016-09-10 Thread Basile B. via Digitalmars-d-learn
On Saturday, 10 September 2016 at 12:18:22 UTC, Basile B. wrote: On Saturday, 10 September 2016 at 12:12:28 UTC, Basile B. wrote: On Saturday, 10 September 2016 at 12:04:08 UTC, Neurone wrote: Hi, I want to read a text file that contains sha1 hashes in hexidecimal, then convert the hashes bac

Re: Reading hexidecimal from a file

2016-09-10 Thread Basile B. via Digitalmars-d-learn
On Saturday, 10 September 2016 at 12:12:28 UTC, Basile B. wrote: On Saturday, 10 September 2016 at 12:04:08 UTC, Neurone wrote: Hi, I want to read a text file that contains sha1 hashes in hexidecimal, then convert the hashes back into ubyte[20]. Examples of some lines: E9785DC5 D43B5F67 F1

Re: Reading hexidecimal from a file

2016-09-10 Thread Basile B. via Digitalmars-d-learn
On Saturday, 10 September 2016 at 12:04:08 UTC, Neurone wrote: Hi, I want to read a text file that contains sha1 hashes in hexidecimal, then convert the hashes back into ubyte[20]. Examples of some lines: E9785DC5 D43B5F67 F1B7D1CB 33279B7C 284E2593 04150E8F 1840BCA2 972BE1C5 2DE81039

Re: Functions, nothrow and assert

2016-09-08 Thread Basile B. via Digitalmars-d-learn
On Thursday, 8 September 2016 at 11:40:17 UTC, Russel Winder wrote: Is the fact that: void f() nothrow { assert(1 == 0); } int main() { f(); return 0; } compiles fine but at run time f does indeed throw an exception what should happen? If it

Re: Performance issue with GC

2016-09-07 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:20:30 UTC, Yuxuan Shui wrote: I have a little data processing program which makes heavy use of associative arrays, and GC almost doubles the runtime of it (~2m with GC disabled -> ~4m). I just want to ask what's the best practice in this situation? Do I ju

Re: dependency analysis for makefile construction

2016-09-06 Thread Basile B. via Digitalmars-d-learn
On Monday, 5 September 2016 at 18:49:25 UTC, Basile B. wrote: On Monday, 5 September 2016 at 18:22:08 UTC, ag0aep6g wrote: On 09/04/2016 12:07 AM, dan wrote: Are there any FOSS tools for doing dependency analysis of [...] [...] I'm not aware of a standalone tool that does something like this.

Re: dependency analysis for makefile construction

2016-09-05 Thread Basile B. via Digitalmars-d-learn
On Monday, 5 September 2016 at 18:22:08 UTC, ag0aep6g wrote: On 09/04/2016 12:07 AM, dan wrote: Are there any FOSS tools for doing dependency analysis of [...] [...] I'm not aware of a standalone tool that does something like this. If you want to write one, you could do like rdmd and use `dmd

Re: Assign any event kind to a single templatized function ?

2016-09-05 Thread Basile B. via Digitalmars-d-learn
On Monday, 5 September 2016 at 14:00:04 UTC, ag0aep6g wrote: On 09/05/2016 03:44 PM, Basile B. wrote: [...] You can pass the delegate type itself by alias. Then Parameters carries over the ref. Not sure if that's well-defined or if it just happens to work. void handlef(F)(Parameters!F

Re: Assign any event kind to a single templatized function ?

2016-09-05 Thread Basile B. via Digitalmars-d-learn
On Monday, 5 September 2016 at 13:44:53 UTC, Basile B. wrote: Typo, last line should be: foo.event3 = &handler.handleref!(Parameters!(foo.event3)); But it still doesnt work.

Assign any event kind to a single templatized function ?

2016-09-05 Thread Basile B. via Digitalmars-d-learn
It's almost a "yeah". However this doesn't work with ref parameters. Any idea how to make this work, keeping the simplicity of the concept ? °° module runnable; import std.stdio; struct Foo { void delegate(int) event1; void delegate(int,int) event2; voi

Re: Hash table element existence check

2016-09-03 Thread Basile B. via Digitalmars-d-learn
On Friday, 2 September 2016 at 19:38:34 UTC, Illuminati wrote: I am trying to create a hash table and would like an efficient way to be able to know if an element exists to test for collisions. I could keep a bitarray, but wasting around 12% space. I could use pointers(null check) to elements

Re: DUB, link automatically right object for platform and archi

2016-09-02 Thread Basile B. via Digitalmars-d-learn
On Friday, 2 September 2016 at 03:24:58 UTC, rikki cattermole wrote: On 02/09/2016 6:01 AM, Basile B. wrote: [...] What's wrong in my description ? For starters Ouch... buildSettings is just a name given to a group of properties. It doesn't actually go INTO the dub file. Thx much, this e

Re: DUB, link automatically right object for platform and archi

2016-09-01 Thread Basile B. via Digitalmars-d-learn
On Thursday, 1 September 2016 at 18:01:19 UTC, Basile B. wrote: I've converted this section: [...] to: "buildSettings" : { "dflags-linux-x86" : ["objects/coff32/beaengine.o"], "dflags-linux-x86_64" : ["objects/coff64/beaengine.o"], "dflags-windows-x86" : ["objects\\omf32\\beaengin

DUB, link automatically right object for platform and archi

2016-09-01 Thread Basile B. via Digitalmars-d-learn
I've converted this section: "configurations" : [ { "name" : "nux32", "dflags" : [ "objects/coff32/beaengine.o" ] }, { "name" : "nux64", "dflags" : [ "objects/coff64/beaengine.o" ] }, { "name" : "win32", "dflags"

Re: Overriding abstract class fields

2016-09-01 Thread Basile B. via Digitalmars-d-learn
On Thursday, 1 September 2016 at 11:09:18 UTC, slaid wrote: I have a snippet: How do I override this height field? Thanks The field height is not overridden. In C you have two "height". Since your array is of type A[], map takes A.height. abstract class A { int height = 0; } class B :

Re: RDTSCP from dlang

2016-08-31 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 31 August 2016 at 07:34:14 UTC, kookman wrote: On Tuesday, 30 August 2016 at 09:04:41 UTC, Basile B. wrote: Indeed, I want to use rdtscp to get access to the core ID it makes available (to at least know when tsc is from different cores/packages). I guess in the meantime I can use

Re: RDTSCP from dlang

2016-08-30 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 30 August 2016 at 02:04:55 UTC, kookman wrote: I need to access the x86_64 RDTSCP assembly instruction from D. I found this for C++: http://stackoverflow.com/questions/14783782/which-inline-assembly-code-is-correct-for-rdtscp Does anyone here know how (if?) I can do this from D? A

Re: Float values are wrong in union

2016-08-29 Thread Basile B. via Digitalmars-d-learn
On Monday, 22 August 2016 at 18:19:52 UTC, Engine Machine wrote: On Monday, 22 August 2016 at 05:02:41 UTC, jkpl wrote: On Monday, 22 August 2016 at 04:52:40 UTC, Cauterite wrote: [...] That's a 32 bit codegen issue then because DMD64 's disasm shows that SSE regs are used: x86 give 7FF and

Re: mutable destructor? WAT???

2016-08-28 Thread Basile B. via Digitalmars-d-learn
On Sunday, 28 August 2016 at 09:43:02 UTC, Jack Applegame wrote: object.destroy doesn't want to destroy const structure with destructor: [...] Is there a bug in druntime? Yes and I believe this is https://issues.dlang.org/show_bug.cgi?id=4338

Re: Static CT Factory

2016-08-18 Thread Basile B. via Digitalmars-d-learn
On Friday, 19 August 2016 at 01:53:22 UTC, Engine Machine wrote: On Friday, 19 August 2016 at 01:25:10 UTC, Anonymouse wrote: On Friday, 19 August 2016 at 01:10:42 UTC, Engine Machine x = 1.234; Ok, well, I guess the error comes from something else. *x = 1.234 for when T verifies is(T == int

Re: Virtual Classes?

2016-08-17 Thread Basile B. via Digitalmars-d-learn
On Thursday, 18 August 2016 at 03:58:00 UTC, Meta wrote: On Thursday, 18 August 2016 at 02:55:49 UTC, Basile B. wrote: On Thursday, 18 August 2016 at 02:51:48 UTC, Meta wrote: On Thursday, 18 August 2016 at 00:49:49 UTC, Engine Machine wrote: https://en.wikipedia.org/wiki/Virtual_class Can D

Re: Virtual Classes?

2016-08-17 Thread Basile B. via Digitalmars-d-learn
On Thursday, 18 August 2016 at 02:51:48 UTC, Meta wrote: On Thursday, 18 August 2016 at 00:49:49 UTC, Engine Machine wrote: https://en.wikipedia.org/wiki/Virtual_class Can D do stuff like this naturally? Yes, D's `alias this` feature supports this. https://dlang.org/spec/class.html#alias-thi

Re: Virtual Classes?

2016-08-17 Thread Basile B. via Digitalmars-d-learn
On Thursday, 18 August 2016 at 00:49:49 UTC, Engine Machine wrote: https://en.wikipedia.org/wiki/Virtual_class Can D do stuff like this naturally? Not naturally. The ancestor must be specified for the inner "virtual class": °°° class Foo { class Internal

Re: Privacy violation depending on who passes a compile-time argument?

2016-08-14 Thread Basile B. via Digitalmars-d-learn
On Sunday, 14 August 2016 at 17:23:06 UTC, Basile B. wrote: On Sunday, 14 August 2016 at 16:34:48 UTC, rcorre wrote: On Sunday, 14 August 2016 at 15:47:16 UTC, Basile B. wrote: getMember_i is just an alias to that, so shouldn't it also be private? It is private: https://dpaste.dzfl.pl/83fcca8

Re: Privacy violation depending on who passes a compile-time argument?

2016-08-14 Thread Basile B. via Digitalmars-d-learn
On Sunday, 14 August 2016 at 16:34:48 UTC, rcorre wrote: On Sunday, 14 August 2016 at 15:47:16 UTC, Basile B. wrote: getMember_i is just an alias to that, so shouldn't it also be private? It is private: https://dpaste.dzfl.pl/83fcca84dde3, so the code you've posted in the first message could

Re: Privacy violation depending on who passes a compile-time argument?

2016-08-14 Thread Basile B. via Digitalmars-d-learn
On Sunday, 14 August 2016 at 12:03:28 UTC, rcorre wrote: Can someone help me understand why the first line is fine, but the second triggers a deprecation warning for access to a private variable? --- import std.traits; import s; pragma(msg, hasUDA!(S.getMember_i, attr)); // fine pragma(msg,

Re: DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 14 August 2016 at 03:10:28 UTC, WhatMeWorry wrote: On Sunday, 14 August 2016 at 01:05:33 UTC, Basile B. wrote: On Saturday, 13 August 2016 at 21:56:49 UTC, WhatMeWorry wrote: $ sudo chmod -v 777 * mode of 'HelloWindow' changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx) $ ls -al tot

Re: DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 14 August 2016 at 03:42:34 UTC, Basile B. wrote: On Sunday, 14 August 2016 at 03:20:02 UTC, Adam D. Ruppe wrote: On Saturday, 13 August 2016 at 18:28:20 UTC, WhatMeWorry wrote: $ dub run Performing "debug" build using dmd for x86_64. Running ./bin/HelloWindow Not an executable file:

Re: DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 14 August 2016 at 03:20:02 UTC, Adam D. Ruppe wrote: On Saturday, 13 August 2016 at 18:28:20 UTC, WhatMeWorry wrote: $ dub run Performing "debug" build using dmd for x86_64. Running ./bin/HelloWindow Not an executable file: ./bin/HelloWindow I kinda betcha dub is lying about 64 bit.

Re: DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-13 Thread Basile B. via Digitalmars-d-learn
On Saturday, 13 August 2016 at 21:56:49 UTC, WhatMeWorry wrote: $ sudo chmod -v 777 * mode of 'HelloWindow' changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx) $ ls -al total 3016 drwxr-xr-x 2 generic generic4096 Aug 13 16:48 . drwxr-xr-x 7 generic generic4096 Aug 12 23:14 .. -rw-r--r--

Re: platform specific api usage

2016-08-13 Thread Basile B. via Digitalmars-d-learn
On Saturday, 13 August 2016 at 08:11:50 UTC, Brons wrote: Hi, Im trying to make a application to have global system hotkeys, and key emulation. Ive found: https://github.com/dlang/druntime/tree/master/src/core/sys/ https://github.com/madadam/X11.d/tree/master/X11 https://github.com/smjgordon/b

Re: Tracking memory usage

2016-08-06 Thread Basile B. via Digitalmars-d-learn
On Sunday, 7 August 2016 at 00:28:40 UTC, Alfred Pincher wrote: Hi, I have written some code that tracks all memory allocations and deallocations when using my own memory interface. It is non gc based. It reports the results of each allocation when the memory balance for the pointer allocated

Re: Empty LST files?

2016-07-31 Thread Basile B. via Digitalmars-d-learn
On Sunday, 31 July 2016 at 08:29:47 UTC, Basile B. wrote: On Sunday, 31 July 2016 at 01:10:40 UTC, Thalamus wrote: Any idea what I'm doing wrong? Yes, what's going wrong is quite actually you said that the LST is well generated but empty so my previous answer is wrong, also i was focused o

Re: Empty LST files?

2016-07-31 Thread Basile B. via Digitalmars-d-learn
On Sunday, 31 July 2016 at 01:10:40 UTC, Thalamus wrote: I'm running into a problem where when I specify -cov in the DMD compiler command, the coverage LST files are generated, but they're all empty. Has anyone else run into this before? My command line is: dmd -m64 -gc -debug -w -wi -cov -X

Re: How do you test whether a variable is static or not?

2016-07-30 Thread Basile B. via Digitalmars-d-learn
On Saturday, 30 July 2016 at 13:04:56 UTC, Ali Çehreli wrote: On 07/30/2016 05:47 AM, Jonathan M Davis via Digitalmars-d-learn wrote: > I'm writing some serialization code where I need to skip static variables. > So, I have a symbol from a struct, and I'd like to test whether it's static > or no

Re: How do you test whether a variable is static or not?

2016-07-30 Thread Basile B. via Digitalmars-d-learn
On Saturday, 30 July 2016 at 12:47:10 UTC, Jonathan M Davis wrote: I'm writing some serialization code where I need to skip static variables. So, I have a symbol from a struct, and I'd like to test whether it's static or not. Ideally, I'd be able to do something like is(field == static) but

Re: FunctionTypeOf behaves unexpectedly for function pointers?

2016-07-30 Thread Basile B. via Digitalmars-d-learn
On Friday, 29 July 2016 at 13:54:13 UTC, pineapple wrote: This failure seems curious and I haven't been able to understand why it occurs, or whether it might be intentional. For all other callable types, including functions and delegates and types implementing opCall, the assertion passes.

Re: [OT] Re: Problems with -fPIC, libraries and exceptions (in linux?)

2016-07-16 Thread Basile B. via Digitalmars-d-learn
On Sunday, 17 July 2016 at 05:07:00 UTC, Basile B. wrote: On Saturday, 16 July 2016 at 20:13:00 UTC, Seb wrote: On Friday, 15 July 2016 at 08:40:02 UTC, Arafel wrote: Just as a follow-up, I think it's looking more and more like a compiler bug. It works properly both with gdc and ldmd2. Should

[OT] Re: Problems with -fPIC, libraries and exceptions (in linux?)

2016-07-16 Thread Basile B. via Digitalmars-d-learn
On Saturday, 16 July 2016 at 20:13:00 UTC, Seb wrote: On Friday, 15 July 2016 at 08:40:02 UTC, Arafel wrote: Just as a follow-up, I think it's looking more and more like a compiler bug. It works properly both with gdc and ldmd2. Should I make a bug report about that? Yes please. Hi, you wan

Re: Are templates with variadic value parameters possible?

2016-07-14 Thread Basile B. via Digitalmars-d-learn
On Friday, 15 July 2016 at 04:38:03 UTC, Basile B. wrote: two obvious: - recursive template. - staticIota in a foreach. (aliasSeqOf!(iota(1, T.length)) even better: template sameType(T...) { import std.meta; static if (!T.length) enum sameType = false; else enum sa

Re: Are templates with variadic value parameters possible?

2016-07-14 Thread Basile B. via Digitalmars-d-learn
On Friday, 15 July 2016 at 04:31:08 UTC, Devin Hill wrote: Thanks, that way of doing it does work. I guess that means there's no easy way to make sure all T are the same type without a template constraint? Yes, immediatly, now, I think that a contraint has to be used. But you have several cho

Re: Are templates with variadic value parameters possible?

2016-07-14 Thread Basile B. via Digitalmars-d-learn
On Friday, 15 July 2016 at 03:43:49 UTC, Devin Hill wrote: Hi everyone, I have a struct template which takes an integer n, and then has a constructor taking that many arguments of type long, which looks like: struct Struct(int n) { this(long[n] nums...) { /* stuff */ } } This works and

Re: Defining and overriding methods of an abstract base class which must accept a template parameter

2016-07-10 Thread Basile B. via Digitalmars-d-learn
On Sunday, 10 July 2016 at 21:27:14 UTC, pineapple wrote: On Sunday, 10 July 2016 at 21:20:34 UTC, Basile B. wrote: The problem you encounter here is that templatized functions cannot be virtual. If you remove "abstract" and put an empty body than it works, but you lose the whole OOP thing, i.e

Re: Defining and overriding methods of an abstract base class which must accept a template parameter

2016-07-10 Thread Basile B. via Digitalmars-d-learn
On Sunday, 10 July 2016 at 21:20:34 UTC, Basile B. wrote: On Sunday, 10 July 2016 at 21:06:42 UTC, pineapple wrote: [...] It comes from the fact that the VTBL cannot be build from a template. See https://issues.dlang.org/show_bug.cgi?id=1657#c1

Re: Defining and overriding methods of an abstract base class which must accept a template parameter

2016-07-10 Thread Basile B. via Digitalmars-d-learn
On Sunday, 10 July 2016 at 21:06:42 UTC, pineapple wrote: This is essentially what I'm trying to accomplish. The intuitive solution, of course, does not work. In theory I could write a separate method for every anticipated return type, but that would be horrible and in that case I'd probably ju

Re: local const functions - bug ?

2016-07-10 Thread Basile B. via Digitalmars-d-learn
On Sunday, 10 July 2016 at 07:20:29 UTC, Meta wrote: On Friday, 8 July 2016 at 09:01:10 UTC, Marc Schütz wrote: `foo()` is effectively a delegate, therefore `const` applies to the context. AFAIK const on a function can only ever refer to the `this` pointer, but there is no `this` pointer. W

Re: local const functions - bug ?

2016-07-07 Thread Basile B. via Digitalmars-d-learn
On Thursday, 7 July 2016 at 12:24:08 UTC, Edwin van Leeuwen wrote: On Thursday, 7 July 2016 at 10:33:39 UTC, Basile B. wrote: this compiles without error: struct Foo { int i; void bar() { void foo() const { i = 1; } foo; } } In this

local const functions - bug ?

2016-07-07 Thread Basile B. via Digitalmars-d-learn
this compiles without error: struct Foo { int i; void bar() { void foo() const { i = 1; } foo; } } In this case "const" seems to be a noop. Do you think it's a bug ? Shouldn't "const" be applied, despite of foo() inaccessibility ?

Re: webfreak001: Request assist installing workspace-d on Windows

2016-07-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 July 2016 at 19:58:03 UTC, Andrew Edwards wrote: On Tuesday, 5 July 2016 at 19:43:02 UTC, WebFreak001 wrote: On Tuesday, 5 July 2016 at 19:34:48 UTC, Andrew Edwards wrote: It's more than that. Now, it fails because it can't find DMD. As you can see in the build.bat from DCD it

Re: static __gshared struct

2016-07-01 Thread Basile B. via Digitalmars-d-learn
On Friday, 1 July 2016 at 23:26:19 UTC, Hiemlick Hiemlicker wrote: On Friday, 1 July 2016 at 23:03:17 UTC, Basile B. wrote: On Friday, 1 July 2016 at 22:47:21 UTC, Hiemlick Hiemlicker wrote: Ok, Does that mean void main() { static struct Foo{} foo(); } void foo() { Foo f; }

Re: static __gshared struct

2016-07-01 Thread Basile B. via Digitalmars-d-learn
On Friday, 1 July 2016 at 22:47:21 UTC, Hiemlick Hiemlicker wrote: what exactly does this do? are all members _gshared? In this case __gshared is a complete NOOP. __gshared has only an effect on variables. It prevents them to reside in the TLS, so that they can be used by any thread of the pr

Re: Casting classes

2016-07-01 Thread Basile B. via Digitalmars-d-learn
On Friday, 1 July 2016 at 17:32:26 UTC, Basile B. wrote: On Friday, 1 July 2016 at 15:45:35 UTC, Jonathan Marler wrote: How do casts work under the hood? I'm mostly interested in what needs to be done in order to cast a class to a subclass. I'd like to know what is being done to determine whe

Re: Casting classes

2016-07-01 Thread Basile B. via Digitalmars-d-learn
On Friday, 1 July 2016 at 15:45:35 UTC, Jonathan Marler wrote: How do casts work under the hood? I'm mostly interested in what needs to be done in order to cast a class to a subclass. I'd like to know what is being done to determine whether the object is a valid instance of the cast type. If

Re: EnumToFlags

2016-06-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 30 June 2016 at 02:39:22 UTC, JS wrote: I created a type that makes working with flags much easier. Please review for issues and enhancements. It would be nice to simplify the value size code. [...] You can look at this, it's more or less the same concept: https://github.com/BB

Re: TypeInfo_Interface from runtime string?

2016-06-22 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 15:15:51 UTC, Thalamus wrote: Hi everyone, My project includes lots of .Net interop via C linkage. One of the things I need to do is refer in C# to an interface declared in the D code, and then to actually work with the interface concretely in the D layer. So, I

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 09:18:54 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 08:20:00 UTC, Basile B. wrote: Yes it's "WorkingDirectory" (and not current...). But otherwise you can use args[0]. Actually using the cwd in a program is often an error because there is no guarantee that th

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 15:57:36 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 10:14:47 UTC, Basile B. wrote: from args[0] you can get the base bath and since your css is relative to the base path: string cssPath = "test.css"; CssProvider provider = new CssProvider(); pro

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 10:02:01 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 09:27:38 UTC, Basile B. wrote: FOrget any previous comment and in your program use the first argument of the command line to detect your resources, this will solve your problem. For the execution click compil

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 09:18:54 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 08:20:00 UTC, Basile B. wrote: Yes it's "WorkingDirectory" (and not current...). But otherwise you can use args[0]. Actually using the cwd in a program is often an error because there is no guarantee that th

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 07:51:14 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 07:50:13 UTC, TheDGuy wrote: I get 'Failed to execute: 267'. Probably because a symbolic string is used in the run options? https://picload.org/upload,8e3f683557a8cd3401f002304f387932.html That is the corre

Re: Passing anonymous templated functions as template parameters

2016-06-15 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 23:52:56 UTC, Basile B. wrote: On Wednesday, 15 June 2016 at 22:27:38 UTC, pineapple wrote: Here's a simple code example to illustrate what I expected to work and didn't - is this a mistake in my syntax or a limitation of the language? template SomeTemplate(a

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-15 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 23:41:51 UTC, Basile B. wrote: On Wednesday, 15 June 2016 at 17:35:32 UTC, TheDGuy wrote: I'm gonna check on Windows today but in the meantime you can try I've checked on windows and here is what I can say about the problem. - Symbolic strings won't work on the

Re: Passing anonymous templated functions as template parameters

2016-06-15 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 22:27:38 UTC, pineapple wrote: Here's a simple code example to illustrate what I expected to work and didn't - is this a mistake in my syntax or a limitation of the language? template SomeTemplate(alias func){ auto templatefunc(T)(int x){ r

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-15 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 17:35:32 UTC, TheDGuy wrote: On Wednesday, 15 June 2016 at 13:15:56 UTC, Rene Zwanenburg wrote: I'm not familiar with Coedit, but the run options seem to contain a field for setting it: https://github.com/BBasile/Coedit/wiki#run-options You may be able to use the

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 15:00:06 UTC, Basile B. wrote: On Monday, 13 June 2016 at 14:30:13 UTC, Basile B. wrote: On Monday, 13 June 2016 at 11:27:31 UTC, Jacob Carlborg wrote: On 2016-06-13 09:54, Pierre wrote: Thank you i will try it. You don't need to involve the constructor. You can us

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 14:30:13 UTC, Basile B. wrote: On Monday, 13 June 2016 at 11:27:31 UTC, Jacob Carlborg wrote: On 2016-06-13 09:54, Pierre wrote: Thank you i will try it. You don't need to involve the constructor. You can use .tupleof, as I mentioned [1] [2]. [1] http://forum.dla

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 11:27:31 UTC, Jacob Carlborg wrote: On 2016-06-13 09:54, Pierre wrote: Thank you i will try it. You don't need to involve the constructor. You can use .tupleof, as I mentioned [1] [2]. [1] http://forum.dlang.org/post/njlohq$1n99$1...@digitalmars.com [2] http://for

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 07:53:08 UTC, Jacob Carlborg wrote: On 2016-06-13 09:49, Jacob Carlborg wrote: For fields, used .tupleof, for other symbols, use a pointer. Here's an example [1] of accessing a field using the name of the field as a string. It will bypass private. That module [1]

Re: Access private member

2016-06-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 June 2016 at 07:43:09 UTC, Pierre wrote: Hi, I would like to know how can i access private member of class from outside ? I think about serialization for instance, serializer must have access to protected attributes. How this is done ? Thank you. You can perform the introspecti

Re: How to detect/filter modules in __traits(allMembers)?

2016-06-11 Thread Basile B. via Digitalmars-d-learn
On Saturday, 11 June 2016 at 19:45:56 UTC, Random D user wrote: Any good ideas how to do that? I couldn't figure it out in a short amount of time, but I expect that it's possible. I'm probably missing something obvious here. Probably because D's reflection/meta programming facilities are a bi

Re: Implicit conversion of struct to bool for if (s) operation ?

2016-06-07 Thread Basile B. via Digitalmars-d-learn
On Monday, 6 June 2016 at 15:34:18 UTC, chmike wrote: On Monday, 6 June 2016 at 15:28:35 UTC, John wrote: Thank you John and Adam. That was a quick answer ! Too late but another option would have been to put an alias this on a bool getter: struct Info { bool getStuff() { retu

Re: Easier way to add libraries to visual d?

2016-06-07 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 7 June 2016 at 08:49:16 UTC, TheDGuy wrote: On Friday, 3 June 2016 at 16:20:53 UTC, TheDGuy wrote: On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote: colorize works. You meant "serial-port" ? Does Coedit have the possibility to debug? Yes / No? No

Re: Getting the parameters and other attributes belonging to the function overload with the greatest number of arguments

2016-05-31 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 20:06:47 UTC, pineapple wrote: I'd like to find the overload of some function with the most parameters and (in this specific case) to get their identifiers using e.g. ParameterIdentifierTuple. There have also been cases where I'd have liked to iterate over the result

<    1   2   3   4   5   6   7   8   >