import("dir/file") does not work

2016-05-17 Thread Vadim Lopatin via Digitalmars-d-learn
Hello, Is it intended that import of file as array does not work if path is specified for import file name? import("dir/file.ext"); // does not work import("file.ext"); // works if dir is added to -J list I believe it would be convenient if I could just specify one -J path (e.g. -Jviews)

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-17 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 21:49:28 UTC, TheDGuy wrote: Okay i now have several ".obj" files in "Tango-D2-d2port\build\bin\win32" but how can i merge them to a library? Anyone here who knows that? Seigelord's port to D2 has a dub.json file, so you should be able to do this: cd

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-17 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 17:40:40 UTC, TheDGuy wrote: Manually Build and Install This is recommended for end users who are installing into an existing compiler, and for developers who wish to work on Tango itself. This section is out of date. ???" All of dsource.org is outdated. It's

union alignment

2016-05-17 Thread tsbockman via Digitalmars-d-learn
Is this a bug? --- module app; union Foo(A, B) { A a; B b; } void main() { alias F = Foo!(double, ulong); import std.stdio, std.algorithm; writefln("sizeof: (%s >= %s) == %s", F.sizeof, max(double.sizeof, ulong.sizeof), F.sizeof >= max(double.sizeof,

Re: How to make a logger (possible bug)

2016-05-17 Thread Seb via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 18:59:31 UTC, Rishub Nagpal wrote: https://dlang.org/phobos/std_experimental_logger_filelogger.html import std.experimental.logger; void main() { auto l1 = new FileLogger("logFile", "loggerName"); } throws an error: Error: none of the overloads of '__ctor'

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-17 Thread TheDGuy via Digitalmars-d-learn
Okay i now have several ".obj" files in "Tango-D2-d2port\build\bin\win32" but how can i merge them to a library? Anyone here who knows that?

Re: Void pointers

2016-05-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 18:25:46 UTC, ag0aep6g wrote: On 05/17/2016 07:43 PM, Alex wrote: The relation is: some object A contains the pointer/iota/(if at all) some object B makes slices of the thing, which is in A. Ok, so you have some object that stores a void pointer. The pointer is

Re: How to Deify char**

2016-05-17 Thread ag0aep6g via Digitalmars-d-learn
On 05/17/2016 09:37 PM, WhatMeWorry wrote: I'm weak enough with C pointers, but when I see char** my brain freezes up like a deer caught in headlights. Can anyone translate the below C call into D? First things first: char** is a perfectly fine D type, of course. But you probably know that.

How to Deify char**

2016-05-17 Thread WhatMeWorry via Digitalmars-d-learn
I'm weak enough with C pointers, but when I see char** my brain freezes up like a deer caught in headlights. Can anyone translate the below C call into D? ALURE_API const ALCchar** ALURE_APIENTRY alureGetDeviceNames(ALCboolean all,ALCsizei *count) // my poor attempt to Deify it int

How to make a logger (possible bug)

2016-05-17 Thread Rishub Nagpal via Digitalmars-d-learn
https://dlang.org/phobos/std_experimental_logger_filelogger.html import std.experimental.logger; void main() { auto l1 = new FileLogger("logFile", "loggerName"); } throws an error: Error: none of the overloads of '__ctor' are callable using argument types (string, string), candidates

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-17 Thread TheDGuy via Digitalmars-d-learn
Okay i now got a step further. If i type: bob -vu C:\Users\Standardbenutzer\Downloads\Tango-D2-d2port a huge list of files comes down such as: dmd -c -IC:\Users\Standardbenutzer\Downloads\Tango-D2-d2port -release -ofngo-core-Array-release.obj

Re: Void pointers

2016-05-17 Thread ag0aep6g via Digitalmars-d-learn
On 05/17/2016 07:43 PM, Alex wrote: The relation is: some object A contains the pointer/iota/(if at all) some object B makes slices of the thing, which is in A. Ok, so you have some object that stores a void pointer. The pointer is going to be null at all times. Then you slice that pointer.

Re: Void pointers

2016-05-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 17:25:48 UTC, ag0aep6g wrote: On 05/17/2016 05:33 PM, Alex wrote: But, if the slicing is made by means of iota, there is no (at least no explicit) dependence between the slices, which could be made by different objects. How is this dependency expressed with slices?

Compile Tango for DMD2 - Any instructions how to do it?

2016-05-17 Thread TheDGuy via Digitalmars-d-learn
Hi, i am wondering if there are any instructions how to build tango with dmd2 on windows? I mean, if i take a look at this: http://dsource.org/projects/tango/wiki/WindowsInstall "Automated Build and Install This section is out of date. Is there an installer at all? Manually Build and

Re: Void pointers

2016-05-17 Thread ag0aep6g via Digitalmars-d-learn
On 05/17/2016 05:33 PM, Alex wrote: But, if the slicing is made by means of iota, there is no (at least no explicit) dependence between the slices, which could be made by different objects. How is this dependency expressed with slices? I'm ready to admit, that the process will work with

Re: Abstract attribute ?

2016-05-17 Thread Lucien via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 16:58:30 UTC, Adam D. Ruppe wrote: On Tuesday, 17 May 2016 at 16:52:01 UTC, Lucien wrote: Why a attribute cannot be abstract ? Because it cannot be virtual and cannot be overridden. This is different than Python, but in line with other C-style languages (and the

Re: Issue with casting types

2016-05-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/17/16 10:19 AM, Thorsten Sommer wrote: On Tuesday, 17 May 2016 at 13:13:54 UTC, Steven Schveighoffer wrote: On 5/17/16 8:59 AM, Steven Schveighoffer wrote: I think you need to avoid it for now. Please file an issue. I see from ag0aep6g, that there is already an issue. I updated it.

Re: Abstract attribute ?

2016-05-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 16:52:01 UTC, Lucien wrote: Why a attribute cannot be abstract ? Because it cannot be virtual and cannot be overridden. This is different than Python, but in line with other C-style languages (and the lower level implementation) Use a property function instead to

Re: Async or event library

2016-05-17 Thread Kagamin via Digitalmars-d-learn
On Monday, 16 May 2016 at 17:08:32 UTC, chmike wrote: - There is no need to preallocate a buffer for all input channels that can stay idle for a long time. This doesn't scale well to million connections. Can you request one byte and then read what was buffered?

Abstract attribute ?

2016-05-17 Thread Lucien via Digitalmars-d-learn
Hello, Why a attribute cannot be abstract ? How can I force the redefinition of an attribute if the class inherits from abstract class ? Example: abstract class A { // Error: variable attr cannot be abstract protected abstract int attr; } class B : A { protected override

Re: Void pointers

2016-05-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 13:25:34 UTC, ag0aep6g wrote: On 05/17/2016 03:14 PM, Alex wrote: For a slice I surely need two numbers. But this should all be, what I need for a slice. For a iota, I need a maximum, which is not provided (at least at this moment) to the object containing the

Re: Issue with casting types

2016-05-17 Thread Thorsten Sommer via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 13:13:54 UTC, Steven Schveighoffer wrote: On 5/17/16 8:59 AM, Steven Schveighoffer wrote: I think you need to avoid it for now. Please file an issue. I see from ag0aep6g, that there is already an issue. I updated it. -Steve Thanks ag0aep6g and Steve for the

Re: Void pointers

2016-05-17 Thread ag0aep6g via Digitalmars-d-learn
On 05/17/2016 03:14 PM, Alex wrote: For a slice I surely need two numbers. But this should all be, what I need for a slice. For a iota, I need a maximum, which is not provided (at least at this moment) to the object containing the pointer/iota thing. The slice's length is practically the same

Re: Void pointers

2016-05-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 12:24:58 UTC, ag0aep6g wrote: On 05/17/2016 12:53 PM, Alex wrote: 2. If I want to be able to slice a iota, I have to initialize it with the last number. But the object, which stores the pointer does not need to know anything about this number. So, I rather would not

Re: Issue with casting types

2016-05-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/17/16 8:59 AM, Steven Schveighoffer wrote: I think you need to avoid it for now. Please file an issue. I see from ag0aep6g, that there is already an issue. I updated it. -Steve

Re: Issue with casting types

2016-05-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/17/16 8:24 AM, Thorsten Sommer wrote: Dear all, I run into an issue with a simple cast: https://dpaste.dzfl.pl/8e7f7c545eb1 I have a base class and a class A with inherit from that base class: A <- BaseClass If the base class contains an "alias this", any casting attempt fails because

Re: Issue with casting types

2016-05-17 Thread ag0aep6g via Digitalmars-d-learn
On 05/17/2016 02:24 PM, Thorsten Sommer wrote: Dear all, I run into an issue with a simple cast: https://dpaste.dzfl.pl/8e7f7c545eb1 I have a base class and a class A with inherit from that base class: A <- BaseClass If the base class contains an "alias this", any casting attempt fails

Re: Void pointers

2016-05-17 Thread ag0aep6g via Digitalmars-d-learn
On 05/17/2016 12:53 PM, Alex wrote: 2. If I want to be able to slice a iota, I have to initialize it with the last number. But the object, which stores the pointer does not need to know anything about this number. So, I rather would not like to pass this number only for being able to instantiate

Issue with casting types

2016-05-17 Thread Thorsten Sommer via Digitalmars-d-learn
Dear all, I run into an issue with a simple cast: https://dpaste.dzfl.pl/8e7f7c545eb1 I have a base class and a class A with inherit from that base class: A <- BaseClass If the base class contains an "alias this", any casting attempt fails because the "alias this" type gets considered.

Re: Void pointers

2016-05-17 Thread ag0aep6g via Digitalmars-d-learn
On 05/17/2016 10:16 AM, Rene Zwanenburg wrote: Additionally, some people recommend never using -release. It depends on that type of program you're writing, but the performance gain is often not worth the loss in safety. Think of the number of exploits enabled by C's lack of bounds checking.

Re: Void pointers

2016-05-17 Thread ag0aep6g via Digitalmars-d-learn
On 05/17/2016 08:53 AM, Alex wrote: the elements of the slice are accessible just for reading, right, but with them I reference the data in other objects. If the slice's pointer is invalid, then its elements are not accessible at all.

Re: Does DUB create .dll files?

2016-05-17 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 05:30:33 UTC, WhatMeWorry wrote: I just incorporated DerelictALURE into a project and it compiled and linked fine, but when I ran the executable, it aborted with:

Re: Void pointers

2016-05-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 08:45:44 UTC, Alex wrote: so... besides void*, ubyte*, a pointer to a strange, not constructible struct, I could take a iota too... a comment on my own: even every type of the above mentioned is possible, there are slightly differences between them: 1. As I don't

Re: Void pointers

2016-05-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 08:16:15 UTC, Rene Zwanenburg wrote: On Tuesday, 17 May 2016 at 06:55:35 UTC, Alex wrote: with dmd test44.d -release the results are: You may want to pass '-O -inline' as well. -O enables general optimizations, -inline enables function inlining. -release is for

Re: Does DUB create .dll files?

2016-05-17 Thread Rene Zwanenburg via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 05:30:33 UTC, WhatMeWorry wrote: Am I supposed to get ALURE32.DLL from somewhere outside of DUB, or did I miss a step or command when I built derelict-alure-master? thanks. You'll need to get the dll somewhere else and set up DUB to copy it to your output

Re: How to find the content of core.sys.* ?

2016-05-17 Thread rikki cattermole via Digitalmars-d-learn
On 17/05/2016 6:55 PM, chmike wrote: Hello, The nice and handy documentation of dlang doesn't provide any info on the core.sys. How can I find out all the things that are in there ? https://github.com/dlang/druntime/tree/master/src/core/sys

Re: Void pointers

2016-05-17 Thread Alex via Digitalmars-d-learn
On Monday, 16 May 2016 at 23:01:44 UTC, ag0aep6g wrote: On 05/17/2016 12:53 AM, Alex wrote: Just as the reality (in my head) is: you can count something without having written the natural numbers before you start to count... iota does that, too. A iota struct doesn't store all the numbers

How to find the content of core.sys.* ?

2016-05-17 Thread chmike via Digitalmars-d-learn
Hello, The nice and handy documentation of dlang doesn't provide any info on the core.sys. How can I find out all the things that are in there ?

Re: Void pointers

2016-05-17 Thread Alex via Digitalmars-d-learn
On Monday, 16 May 2016 at 22:54:31 UTC, ag0aep6g wrote: On 05/17/2016 12:43 AM, Alex wrote: The point is, that in my model the slice has a meaning itself. So, the language provides one of a needed constructs... Huh? As far as I understand, the pointer of the slice is invalid, and you never

Re: D equivalent of C++ bind ?

2016-05-17 Thread chmike via Digitalmars-d-learn
On Monday, 16 May 2016 at 15:57:52 UTC, Dsby wrote: you can remove "auto ref". and I remove the "auto ref" in my use. if used the "alias T", It can not handle all while when the T is a delegate. in C++ std::bind, the arguments order you can sort by used. in D I do not find how to