Re: Test if a class is extern(c++)

2017-04-10 Thread BBasile via Digitalmars-d-learn
On Monday, 10 April 2017 at 18:32:05 UTC, Benjamin Thaut wrote: In particular I want to know if the vtable of the class has the class info member. Is there any way to do this at compile time? At runtime? Kind Regards Benjamin Thaut Hello, I have a trait for this:

Re: working with and installing multiple versions of dmd and D's std-library on linux/ubuntu

2017-01-20 Thread BBasile via Digitalmars-d-learn
On Friday, 20 January 2017 at 09:54:58 UTC, David wrote: Hi I am wondering what a good strategy would be to install and work with multiple versions of DMD and the associated standard library on Linux/Ubuntu? The background is that for some features and libraries I need another

Re: Create Windows "shortcut" (.lnk) with D?

2016-03-05 Thread BBasile via Digitalmars-d-learn
On Sunday, 6 March 2016 at 03:13:23 UTC, 岩倉 澪 wrote: I'm creating a small installation script in D, but I've been having trouble getting shortcut creation to work! I'm a linux guy, so I don't know much about Windows programming... [...] Any help would be highly appreciated as I'm new to

Re: Trouble installing DCD on Windows

2016-02-27 Thread BBasile via Digitalmars-d-learn
On Saturday, 27 February 2016 at 10:16:53 UTC, Minas Mina wrote: Hello. I'm trying to install DCD on windows 8.1 using DUB but I get an error. When executing "dub build --build=release --config=client" I get the following error: => Root package dcd contains reference to invalid package

Re: Using double value in string template mixin

2016-02-26 Thread BBasile via Digitalmars-d-learn
On Friday, 26 February 2016 at 11:26:51 UTC, BBasile wrote: No you cannot because you would have to convert the values to string using std.conv.to or std.format.format(), but they don't work at compile time (see https://issues.dlang.org/show_bug.cgi?id=13568). Erratum! Actually you can,

Re: Using double value in string template mixin

2016-02-26 Thread BBasile via Digitalmars-d-learn
On Friday, 26 February 2016 at 11:13:08 UTC, Dibyendu Majumdar wrote: I am trying something like this: template MyTAlloc(int n_vars, double v) { const char[] MyT = "MyT_init(cast(MyT *) alloca(alloc_size(" ~ n_vars ~ ")), " ~ n_vars ~ ", " ~ v ~ ")"; No you cannot because you would have to

Re: Using double value in string template mixin

2016-02-26 Thread BBasile via Digitalmars-d-learn
On Friday, 26 February 2016 at 11:03:43 UTC, Dibyendu Majumdar wrote: Hi, How do I use a double value in a mixin template that is generating string? Thanks and Regards Dibyendu Have you an example of what's failing right now to show ?

Re: all functions that have a first arg of type T

2016-02-25 Thread BBasile via Digitalmars-d-learn
On Friday, 26 February 2016 at 04:19:29 UTC, BBasile wrote: static if (__traits(isStaticFunction,typeof(m2))) static if (__traits(isStaticFunction, __traits(getMember, vulkan_input, m2 Sorry don't copy paste like this there's a superfluous right paren. static if

Re: all functions that have a first arg of type T

2016-02-25 Thread BBasile via Digitalmars-d-learn
On Friday, 26 February 2016 at 03:57:25 UTC, Nicholas Wilson wrote: foreach(m; __traits(allMembers, vulkan_input)) { static if (m.endsWith("_T")) { foreach(m2; __traits(allMembers, vulkan_input)) { static if (__traits(isStaticFunction,typeof(m2)))// <- what

Re: dub: how to reference a compiled package

2016-02-25 Thread BBasile via Digitalmars-d-learn
On Thursday, 25 February 2016 at 12:15:42 UTC, mahdi wrote: Hi, Suppose I have a package `mypack` in `~/mypack`. I run `dub` command on this package and have the compiled `mypack` file (OS is Linux). Now I am working on my project. I know how to use the source-code of `mypack` package in

template this and traits getOverloads issue.

2015-11-20 Thread BBasile via Digitalmars-d-learn
Background: === http://stackoverflow.com/questions/33764540/warning-about-overriden-methods-when-using-a-mixin Why this horrible trick has to be used: === cast this as (T) in a function template that's been mixed in an ancestor is not always usable,

Re: template this and traits getOverloads issue.

2015-11-20 Thread BBasile via Digitalmars-d-learn
On Friday, 20 November 2015 at 14:18:00 UTC, Alex Parrill wrote: If the mixin has to be used on class and on struct, I cant use an interface. In this case override will create an error and go back to the solution on SO: statically check if things are already there. Templates are not

Re: template this and traits getOverloads issue.

2015-11-20 Thread BBasile via Digitalmars-d-learn
On Friday, 20 November 2015 at 14:39:29 UTC, Alex Parrill wrote: Alternatively, you can use a static method and pass in the instance. Initially this solution looked awesome but when `bug()` is static, `` returns some functions, not some delegates, which is a problem: this implies that I have

Re: template this and traits getOverloads issue.

2015-11-20 Thread BBasile via Digitalmars-d-learn
On Friday, 20 November 2015 at 14:49:28 UTC, Adam D. Ruppe wrote: On Friday, 20 November 2015 at 14:01:13 UTC, BBasile wrote: everything that can be done to avoid the compilations errors will also prevent "bar" to be written in the output (because a B will never be analyzed). The "only" fix I

Re: template this and traits getOverloads issue.

2015-11-20 Thread BBasile via Digitalmars-d-learn
On Friday, 20 November 2015 at 15:03:06 UTC, Adam D. Ruppe wrote: On Friday, 20 November 2015 at 14:18:00 UTC, Alex Parrill wrote: But you don't need a template for this case; mixin templates have access to `this`: Indeed, this is a good answer too. The difference between this and the

Re: Linker error from dub?

2015-11-11 Thread BBasile via Digitalmars-d-learn
On Thursday, 12 November 2015 at 02:02:56 UTC, Stiff wrote: Possibly a dumb question, I'm not sure. [...] undefined reference to `cblas_dgemm' collect2: error: ld returned 1 exit status --- errorlevel 1 dmd failed with exit code 1. Any suggestions? I do have a blas library installed, but the

Re: Linker error from dub?

2015-11-11 Thread BBasile via Digitalmars-d-learn
On Thursday, 12 November 2015 at 05:44:37 UTC, Stiff wrote: On Thursday, 12 November 2015 at 05:17:58 UTC, BBasile wrote: On Thursday, 12 November 2015 at 02:02:56 UTC, Stiff wrote: Possibly a dumb question, I'm not sure. [...] undefined reference to `cblas_dgemm' collect2: error: ld returned

Re: Linker error from dub?

2015-11-11 Thread BBasile via Digitalmars-d-learn
On Thursday, 12 November 2015 at 06:03:49 UTC, BBasile wrote: It worked fine because it was not used, not parsed, not linked. Maybe just the functions declarations was parsed to solve the symbols in the program, but since none was used the 'import blas.blas' was eliminated or something like

Re: Deprecation: module std.stream is deprecated

2015-11-08 Thread BBasile via Digitalmars-d-learn
On Sunday, 8 November 2015 at 14:41:11 UTC, Spacen Jasset wrote: But it doesn't seem efficient and strays off the conceptual path. In other words, why chunk things up, join them back, to get a stream? `.byChunk` caches and `.joiner` hides this caching mechanism. Both operations happen under

Re: Parse d source file by using compiler

2015-11-08 Thread BBasile via Digitalmars-d-learn
On Monday, 9 November 2015 at 05:49:25 UTC, tcak wrote: I checked for a flag in this page http://dlang.org/dmd-linux.html , but couldn't have found any for this purpose. Is there a way to parse a d source file so it generates a tree in JSON, XML, or something-that-can-be-processed-easily

Re: conver BigInt to string

2015-11-05 Thread BBasile via Digitalmars-d-learn
On Thursday, 5 November 2015 at 16:39:03 UTC, Namal wrote: On Thursday, 5 November 2015 at 16:35:01 UTC, BBasile wrote: On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote: Hello I am trying to convert BigInt to string like that while trying to sort it: string s1 =

Re: conver BigInt to string

2015-11-05 Thread BBasile via Digitalmars-d-learn
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote: Hello I am trying to convert BigInt to string like that while trying to sort it: string s1 = to!string(a).dup.sort; and get an error cannot implicitly convert expression (_adSortChar(dup(to(a of type char[] to string what do I

Re: Align a variable on the stack.

2015-11-05 Thread BBasile via Digitalmars-d-learn
On Thursday, 5 November 2015 at 03:52:47 UTC, TheFlyingFiddle wrote: [...] I solved the problem by changing the struct to look like this. align(16) struct Pos { float x = float.nan; float y = float.nan; float z = float.nan; float w = float.nan; } wow that's quite strange. FP

Re: How to detect overflow

2015-11-03 Thread BBasile via Digitalmars-d-learn
On Wednesday, 4 November 2015 at 03:55:13 UTC, Namal wrote: Is there a way to detect overflow for example for: int i = 2_000_000_000; int a = i*i*i; writeln(a); -> 1073741824 You can use core.checkedint [1] ---

Re: How to detect overflow

2015-11-03 Thread BBasile via Digitalmars-d-learn
On Wednesday, 4 November 2015 at 07:19:09 UTC, Ali Çehreli wrote: On 11/03/2015 10:34 PM, Namal wrote: http://dlang.org/phobos/core_checkedint.html Is it just an error in the documentation that the return value is stated as sum for the multiplication functions? Yeah, looks like classic

Re: Access violation when calling C DLL from D

2015-11-01 Thread BBasile via Digitalmars-d-learn
On Monday, 2 November 2015 at 01:02:45 UTC, AnoHito wrote: [...] the headers are very long and complicated, and porting them entirely to D would be a huge project in and of itself. [...] You can give a try at h2d, the C header to D interface converter: http://dlang.org/htod.html

Re: Static constructors in structs.

2015-10-30 Thread BBasile via Digitalmars-d-learn
On Friday, 30 October 2015 at 20:58:37 UTC, anonymous wrote: On 30.10.2015 21:23, TheFlyingFiddle wrote: Is this intended to work? struct A { __gshared static this() { //Add some reflection info to some global stuff. addReflectionInfo!(typeof(this)); } } I just

Re: Static constructors in structs.

2015-10-30 Thread BBasile via Digitalmars-d-learn
On Friday, 30 October 2015 at 21:29:22 UTC, BBasile wrote: On Friday, 30 October 2015 at 20:58:37 UTC, anonymous wrote: On 30.10.2015 21:23, TheFlyingFiddle wrote: Is this intended to work? struct A { __gshared static this() { //Add some reflection info to some global stuff.

Re: How to break gdb on D exception ?

2015-10-04 Thread BBasile via Digitalmars-d-learn
On Friday, 2 October 2015 at 09:15:13 UTC, Dmitri wrote: On Friday, 2 October 2015 at 04:50:59 UTC, BBasile wrote: On Friday, 2 October 2015 at 04:46:51 UTC, BBasile wrote: On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote: On Friday, 2 October 2015 at 03:58:45 UTC, BBasile

Re: How to break gdb on D exception ?

2015-10-04 Thread BBasile via Digitalmars-d-learn
On Sunday, 4 October 2015 at 14:31:43 UTC, BBasile wrote: On Friday, 2 October 2015 at 09:15:13 UTC, Dmitri wrote: On Friday, 2 October 2015 at 04:50:59 UTC, BBasile wrote: On Friday, 2 October 2015 at 04:46:51 UTC, BBasile wrote: On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe

How to break gdb on D exception ?

2015-10-01 Thread BBasile via Digitalmars-d-learn
Currently it works fine when throwing with core.exception functions 'on', like explained in the wiki, for example: --- break onFinalizeError --- But I can't manage to break when a new Exception instance is thrown in the code: --- throw new Exception("ouch"); --- none of the following GB

Re: How to break gdb on D exception ?

2015-10-01 Thread BBasile via Digitalmars-d-learn
On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote: On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote: none of the following GB commands work: give break d_throw or maybe `break d_throwc` a try unfortunately it doesn't work, i get --- (gdb) Function

Re: How to break gdb on D exception ?

2015-10-01 Thread BBasile via Digitalmars-d-learn
On Friday, 2 October 2015 at 04:46:51 UTC, BBasile wrote: On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote: On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote: none of the following GB commands work: give break d_throw or maybe `break d_throwc` a try unfortunately it

Re: How to break gdb on D exception ?

2015-10-01 Thread BBasile via Digitalmars-d-learn
On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote: Does anyone manage this ? I meant: Does anyone master this ?

Re: All these errors running basic Pegged helloworld example.

2015-09-27 Thread BBasile via Digitalmars-d-learn
On Sunday, 27 September 2015 at 06:30:37 UTC, Enjoys Math wrote: The example is: import pegged.grammar; mixin(grammar(` Arithmetic: Term < Factor (Add / Sub)* Add < "+" Factor Sub < "-" Factor Factor < Primary (Mul / Div)* Mul < "*" Primary Div

Re: Is there a smart way to process a range of range by front ?

2015-09-23 Thread BBasile via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 21:04:44 UTC, Justin Whear wrote: On Wed, 23 Sep 2015 20:48:03 +, BBasile wrote: I was thinking to a general *interleave()* algorithm for any compatible Range of Range but I can't find any smart way to process each sub range by front Can you show a

Re: Is there a smart way to process a range of range by front ?

2015-09-23 Thread BBasile via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 21:17:29 UTC, BBasile wrote: On Wednesday, 23 September 2015 at 21:04:44 UTC, Justin Whear wrote: On Wed, 23 Sep 2015 20:48:03 +, BBasile wrote: I was thinking to a general *interleave()* algorithm for any compatible Range of Range but I can't find any

Re: Is there a smart way to process a range of range by front ?

2015-09-23 Thread BBasile via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 21:24:22 UTC, Justin Whear wrote: On Wed, 23 Sep 2015 21:17:27 +, BBasile wrote: On Wednesday, 23 September 2015 at 21:04:44 UTC, Justin Whear wrote: On Wed, 23 Sep 2015 20:48:03 +, BBasile wrote: I was thinking to a general *interleave()* algorithm

Is there a smart way to process a range of range by front ?

2015-09-23 Thread BBasile via Digitalmars-d-learn
I was thinking to a general *interleave()* algorithm for any compatible Range of Range but I can't find any smart way to process each sub range by front, eg: --- void interleave(RoR)(RoR r) { r.each!(a => a.writeln); } void main() { auto r = [[0,2],[1,3]]; interleave(r); } ---

Re: Building basic gtkd,opengl application

2015-09-20 Thread BBasile via Digitalmars-d-learn
On Sunday, 20 September 2015 at 22:30:54 UTC, Michał wrote: I am trying to make some application using gtkd and opengl. I have made simple program but it didn't work and I have no idea why. I have never used gtk so maybe I'm doing something stupid : / The code: http://pastebin.com/7NfbMqaK

Re: Building basic gtkd,opengl application

2015-09-20 Thread BBasile via Digitalmars-d-learn
On Monday, 21 September 2015 at 03:26:36 UTC, BBasile wrote: On Sunday, 20 September 2015 at 22:30:54 UTC, Michał wrote: I am trying to make some application using gtkd and opengl. I have made simple program but it didn't work and I have no idea why. I have never used gtk so maybe I'm doing

Re: Contracts with interface

2015-09-19 Thread BBasile via Digitalmars-d-learn
On Saturday, 19 September 2015 at 10:33:12 UTC, tchaloupka wrote: This bites me again: import std.stdio; interface ITest { void test(); void test2() in { writeln("itest2"); } void test3() in { writeln("itest3"); } void test4() in { writeln("itest4");

Re: Difference between back (`) and double (") quoted strings

2015-09-18 Thread BBasile via Digitalmars-d-learn
On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote: Is there any or they are just simply syntactically equivalent? Are there any official docs on this? it's like a raw string (prefixed with a r) so there is escaped char: r"\": correct token for a string, terminal " is not

Re: Difference between back (`) and double (") quoted strings

2015-09-18 Thread BBasile via Digitalmars-d-learn
On Friday, 18 September 2015 at 09:34:38 UTC, BBasile wrote: On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote: Is there any or they are just simply syntactically equivalent? Are there any official docs on this? it's like a raw string (prefixed with a r) so there is escaped

Re: Difference between back (`) and double (") quoted strings

2015-09-18 Thread BBasile via Digitalmars-d-learn
On Friday, 18 September 2015 at 09:35:53 UTC, BBasile wrote: On Friday, 18 September 2015 at 09:34:38 UTC, BBasile wrote: On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote: Is there any or they are just simply syntactically equivalent? Are there any official docs on this?

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-18 Thread BBasile via Digitalmars-d-learn
On Friday, 18 September 2015 at 00:13:41 UTC, BBasile wrote: On Thursday, 17 September 2015 at 22:22:22 UTC, WhatMeWorry wrote: [...] After hours of reading existing freetype/derelict documents, I'm stuck again. Any suggestions. Thanks. Hello, this[1] compiled dll one works fine here on

How not to run after a DUB build ?

2015-09-17 Thread BBasile via Digitalmars-d-learn
Each time I execute `dub.exe --build=release` (or any other the build type) DUB tries to run the project after the build. This generates often generates an error when dub process returns (and even if the build is OK) but actually I don't want DUB to run after building. Is there a switch to

Re: How not to run after a DUB build ?

2015-09-17 Thread BBasile via Digitalmars-d-learn
On Thursday, 17 September 2015 at 19:36:10 UTC, BBasile wrote: Each time I execute `dub.exe --build=release` (or any other the build type) DUB tries to run the project after the build. This generates often generates an error when dub process returns (and even if the build is OK) but actually

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-17 Thread BBasile via Digitalmars-d-learn
On Thursday, 17 September 2015 at 22:22:22 UTC, WhatMeWorry wrote: [...] After hours of reading existing freetype/derelict documents, I'm stuck again. Any suggestions. Thanks. Hello, this[1] compiled dll one works fine here on windows: - inside this folder:

Re: Runtime error when calling a callback in a parallel Task

2015-09-16 Thread BBasile via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 23:49:23 UTC, BBasile wrote: Under Windows this works fine but under Linux I got a runtime error. this could be reduced to : [...] If it can help to understand the problem, here is the unreducted case:

Re: Runtime error when calling a callback in a parallel Task

2015-09-16 Thread BBasile via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 18:19:07 UTC, Ali Çehreli wrote: On 09/15/2015 04:49 PM, BBasile wrote: Under Windows this works fine but under Linux I got a runtime error. Can it be because 'param' is invalid at the time clbck is called? No the callback and its user parameter are set

Re: Runtime error when calling a callback in a parallel Task

2015-09-16 Thread BBasile via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 22:30:26 UTC, Ali Çehreli wrote: On 09/16/2015 02:01 PM, BBasile wrote: > On Wednesday, 16 September 2015 at 18:19:07 UTC, Ali Çehreli wrote: >> On 09/15/2015 04:49 PM, BBasile wrote: >>> Under Windows this works fine but under Linux I got a runtime error. >>

Runtime error when calling a callback in a parallel Task

2015-09-15 Thread BBasile via Digitalmars-d-learn
Under Windows this works fine but under Linux I got a runtime error. this could be reduced to : --- import std.parallelism; alias CallBack = void function(void*); class Foo { CallBack clbck; void* param; void dotask() { // some heavy processing // tells the

Re: how do I check if a member of a T has a member ?

2015-09-13 Thread BBasile via Digitalmars-d-learn
On Sunday, 13 September 2015 at 17:24:20 UTC, Laeeth Isharc wrote: On Sunday, 13 September 2015 at 17:09:57 UTC, wobbles wrote: Use __traits(compiles, date.second)? Thanks. This works: static if (__traits(compiles, { T bar; bar.date.hour;})) pragma(msg,"hour"); else

Re: private selective import not so private ?

2015-09-10 Thread BBasile via Digitalmars-d-learn
On Friday, 11 September 2015 at 00:55:41 UTC, Adam D. Ruppe wrote: On Friday, 11 September 2015 at 00:52:00 UTC, BBasile wrote: While trying to get why some call to memmove without the right import didn't lead to a compilation failure i've found that imported symbols are not private ! Is that

private selective import not so private ?

2015-09-10 Thread BBasile via Digitalmars-d-learn
While trying to get why some call to memmove without the right import didn't lead to a compilation failure i've found that imported symbols are not private ! Is that a bug ? The specs don't say that a selective import is public ! -- other.d -- module other; private import core.stdc.string:

Re: Is D suitable for my latest project?

2015-09-08 Thread BBasile via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 19:30:16 UTC, chris stevens wrote: On Sunday, 6 September 2015 at 14:45:45 UTC, BBasile wrote: You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static

Re: Are there any Phobos functions to check file permissions on Windows and Posix?

2015-09-07 Thread BBasile via Digitalmars-d-learn
On Sunday, 6 September 2015 at 23:05:29 UTC, Jonathan M Davis wrote: [...] which makes treating some of this stuff in a cross-platform fashion quite difficult. And even more with ACLs that it could be: On windows, to know properly if something is readable or writable the attributes are not

Re: Is D suitable for my latest project?

2015-09-06 Thread BBasile via Digitalmars-d-learn
On Sunday, 6 September 2015 at 14:36:53 UTC, chris stevens wrote: - dynamic creation of classes/structs at runtime. You have Object.factory for this. You can also use a custom factory based on string comparison. (with some: static if(condition) return new This; else static if(otherCondition)

Re: Windows Resources

2015-09-05 Thread BBasile via Digitalmars-d-learn
On Saturday, 5 September 2015 at 19:06:15 UTC, Prudence wrote: [...] Check this file https://github.com/D-Programming-Language/dmd/blob/master/samples/winsamp.d ,it's distributed with your D setup.

Re: Create a delegate function

2015-09-05 Thread BBasile via Digitalmars-d-learn
On Saturday, 5 September 2015 at 18:00:53 UTC, Prudence wrote: I have code setup in such a way that I call a user defined function, e.g., void myFunc(Data d) { } myFunc has to be passed to the main code using something like void SetFunc(void function(Data) func) { ... func(myData); }

Re: Working Windows GUI library?

2015-09-03 Thread BBasile via Digitalmars-d-learn
On Thursday, 3 September 2015 at 15:46:28 UTC, Andre Polykanine wrote: [...] Hello, there this one: https://github.com/nomad-software/tkd [...] I don't know what you meant by 'accessible' but the two respective runtimes exist for windows.

Re: Prefer Signed or Unsigned in D?

2015-09-02 Thread BBasile via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 23:06:50 UTC, John Carter wrote: C/C++ discussion here http://blog.robertelder.org/signed-or-unsigned-part-2/ D rules here... http://dlang.org/type.html#integer-promotions It depends on the context. You should take care of blending signed and

Re: Error Compiling with -debug swtich

2015-08-30 Thread BBasile via Digitalmars-d-learn
On Thursday, 27 August 2015 at 22:09:07 UTC, Jordan Wilson wrote: Hello, Just wondering why compiling the following fails with the -debug switch, but appears to compile and execute fine without it: import std.stdio; import std.algorithm; import std.container; int main(string[] args) {

Re: observation: D getting a bit complex

2015-08-30 Thread BBasile via Digitalmars-d-learn
On Sunday, 30 August 2015 at 10:42:24 UTC, Spacen Jasset wrote: On Sunday, 30 August 2015 at 07:36:55 UTC, BBasile wrote: On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range

Re: observation: D getting a bit complex

2015-08-30 Thread BBasile via Digitalmars-d-learn
On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range isSomeString!(ElementType!Range)); pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] paths...) if

Re: stuck on opDiv / opBinary

2015-08-30 Thread BBasile via Digitalmars-d-learn
On Sunday, 30 August 2015 at 17:02:58 UTC, Spacen Jasset wrote: I have just added an opDiv to this class, but it doesn't seem to pick it up. math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3 I can't see why that is, becuase my opMul works in the same place. Can anyone

Re: Arrays of structs

2015-08-27 Thread BBasile via Digitalmars-d-learn
On Thursday, 27 August 2015 at 11:45:14 UTC, anonymous wrote: On Thursday 27 August 2015 13:15, BBasile wrote: https://github.com/BBasile/iz/blob/master/import/iz/types.d#L125 https://github.com/BBasile/iz/blob/master/import/iz/types.d#L150

Re: Arrays of structs

2015-08-27 Thread BBasile via Digitalmars-d-learn
On Thursday, 27 August 2015 at 12:56:26 UTC, anonymous wrote: On Thursday 27 August 2015 14:35, BBasile wrote: Anyway. I cheat a bit with attributes but as long as it's only for me...I know this kinds of functions are not phobos-level. Sure, as long as you're cautious and regard those

Re: Arrays of structs

2015-08-27 Thread BBasile via Digitalmars-d-learn
On Thursday, 27 August 2015 at 10:05:31 UTC, John Burton wrote: I'm a c++ programmer trying to understand how memory allocation works in D. I created a struct and added a destructor to it. My understanding is that structs have deterministic destructors - they are called when the struct goes

Re: Arrays of structs

2015-08-27 Thread BBasile via Digitalmars-d-learn
On Thursday, 27 August 2015 at 10:49:02 UTC, John Burton wrote: Thanks again for the updates. I've experimented some more and believe I understand. To be honest I'm finding it very hard to find the right idioms in D for safe and efficient programming when I'm so used to C++ / RAII

Re: linking-in libs under linux needed and not under windows

2015-08-27 Thread BBasile via Digitalmars-d-learn
On Thursday, 27 August 2015 at 04:57:14 UTC, Adam D. Ruppe wrote: On Thursday, 27 August 2015 at 02:50:58 UTC, BBasile wrote: So the Q: Is this difference normal ? Yes, it is a feature the Windows format supports but the Linux one doesn't. On Linux, you need to list the libraries on the

Re: linking-in libs under linux needed and not under windows

2015-08-26 Thread BBasile via Digitalmars-d-learn
On Thursday, 27 August 2015 at 02:50:58 UTC, BBasile wrote: So the Q: Is this difference normal ? the win OMF linux COFF thing maybe ?

linking-in libs under linux needed and not under windows

2015-08-26 Thread BBasile via Digitalmars-d-learn
let's say i have 'libA', 'libB' and 'Project' - libB uses libA - Project uses libB under Windows (32 bit, OMF objects, Digital Mars linker, so the standard setup): - * libA is compiled with: dmd sourceA.d -lib * libB is compiled with: dmd sourceB.d -lib -IpathToSourceA * Project

Re: Trying to compile weather program

2015-08-23 Thread BBasile via Digitalmars-d-learn
On Sunday, 23 August 2015 at 09:54:37 UTC, Tony wrote: I found this weather program on the main page (it seems to rotate what it here): [...] try with `center()` or update the compiler. centerJustifier() was added on 25 Apr 2015 so after 2.066.1 release:

Re: Appender at CTFE?

2015-08-22 Thread BBasile via Digitalmars-d-learn
On Friday, 21 August 2015 at 23:51:16 UTC, cym13 wrote: On Friday, 21 August 2015 at 22:39:29 UTC, Nick Sabalausky wrote: Not at a pc, so can't test right now, but does Appender work at compile time? If not, does ~= still blow up CTFE memory usage like it used to? Any other best practice /

Re: most elegant functional way to make a histogram

2015-08-21 Thread BBasile via Digitalmars-d-learn
On Friday, 21 August 2015 at 20:09:22 UTC, Laeeth Isharc wrote: I have four arrays of ints, each array representing a kind of event associated with that int (they all map to the same space). Each array might have the same number multiple times and each array will be of different length. So

Re: Real OOP with D

2015-08-18 Thread BBasile via Digitalmars-d-learn
On Tuesday, 18 August 2015 at 06:27:53 UTC, Ozan wrote: On Monday, 17 August 2015 at 06:59:51 UTC, BBasile wrote: On Monday, 17 August 2015 at 05:57:52 UTC, Ozan wrote: Hi [...] Is there any way to get real OOP with D? Regards, Ozan Can you name an OOP oriented language that allows this

Re: Real OOP with D

2015-08-17 Thread BBasile via Digitalmars-d-learn
On Monday, 17 August 2015 at 05:57:52 UTC, Ozan wrote: Hi Working with objectoriented concepts results often in large trees of related classes. Every instance of a class knows his methods and data. An example like following would work: import std.stdio; class Family { } class Dad : Family

Re: pragma(mangle, on a template)

2015-08-16 Thread BBasile via Digitalmars-d-learn
On Monday, 17 August 2015 at 02:46:02 UTC, Freddy wrote: I can't get pragma(mangle) to work on templates(or structs). [...] I don't know why but it looks like it only works on functions. Even if a struct is not a template the custom symbol mangle won't be handled: --- import std.stdio;

Re: Weird error message.

2015-08-16 Thread BBasile via Digitalmars-d-learn
On Monday, 17 August 2015 at 00:00:11 UTC, Jonathan M Davis wrote: On Sunday, August 16, 2015 21:32:08 Warwick via Digitalmars-d-learn wrote: Dont know what to make of this, I pretty much get it every other time I call rdmd. It'll alternate between running fine and then giving me this error...

Re: Template Collections of Different Types

2015-08-15 Thread BBasile via Digitalmars-d-learn
On Sunday, 16 August 2015 at 01:39:54 UTC, DarthCthulhu wrote: Say I want to do something like: Propertery!int pi = 42; PropertyCollection pc; pc.attach(Life_and_Everything, pi); assert(pc.Life_and_Everything == 42); Property!string ps = Hello World; pc.attach(text, ps); assert(pc.text ==

Re: Associative array literal. Why doesn't it compile?

2015-08-14 Thread BBasile via Digitalmars-d-learn
On Friday, 14 August 2015 at 06:48:27 UTC, Adel Mamin wrote: Compiler dmd_2.068.0-0_amd64.deb on Ubuntu 12.04 Linux: auto lookup = [ one:1, two:2 ]; The dmd error: Error: non-constant expression [one:1, two:2] Why doesn't it compile? As a workaround I could do the assignment one element at a

Re: Derelict, SDL, and OpenGL3: Triangle Tribulations

2015-08-12 Thread BBasile via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 05:46:27 UTC, Mike Parker wrote: On Wednesday, 12 August 2015 at 05:34:22 UTC, BBasile wrote: [...] It seems to me that your driver is doing things it isn't actually supposed to do. This code is binding a vertex buffer object with a function which is

Re: Derelict, SDL, and OpenGL3: Triangle Tribulations

2015-08-11 Thread BBasile via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 03:32:47 UTC, DarthCthulhu wrote: So I decided to try some OGL3 stuff in D utilizing the Derelict bindings and SDL. Creating an SDL-OGL window worked fine, but I'm having trouble with doing the most basic thing of rendering a triangle. I get the window just fine

Re: Import template in phobos

2015-08-01 Thread BBasile via Digitalmars-d-learn
On Saturday, 1 August 2015 at 14:42:47 UTC, vit wrote: Exist in phobos something like Import template? public import std.traits; template Import(alias Module){ mixin(import ~ moduleName!Module ~ ;); } class C; struct Test{ Import!(std.typecons).Rebindable!C test;

Re: Static arrays inside struct and class - bug?

2015-08-01 Thread BBasile via Digitalmars-d-learn
On Saturday, 1 August 2015 at 17:22:40 UTC, NX wrote: I wonder if the followings are compiler bugs: class stuff_class { byte[1024*1024*16] arr; // Error: index 16777216 overflow for static array } struct stuff { byte[1024*1024*16] arr; // Error: index 16777216 overflow for static