Problem with using struct ranges with @disabled this(this) with some range functions

2015-09-01 Thread Uranuz via Digitalmars-d-learn
As far as I understand to save current cursor of forward range I should always use *save* property. But sometimes range struct is just copied using postblit without using save (it happens even in Phobos). Is it correct behaviour to *pass ownership* for range structs via just copying of range or

Re: new static array

2015-09-01 Thread Ali Çehreli via Digitalmars-d-learn
On 09/01/2015 09:47 AM, anonymous wrote:> Hello, > > I tried to send a string[4] with std.concurrency: > > import std.concurrency; > import std.stdio; > void fun() { > receive((string[4] data) { writeln(data);}); > } > > void main() { > string[4] data; > auto tid = spawn(&fun); >

Re: Appenders and Arrays

2015-09-01 Thread Ali Çehreli via Digitalmars-d-learn
On 09/01/2015 02:16 PM, Steven Schveighoffer wrote:> On 9/1/15 3:13 PM, Daniel Kozak via Digitalmars-d-learn wrote: >> >> >> Dne 1.9.2015 v 19:20 Steven Schveighoffer via Digitalmars-d-learn >> napsal(a): >>> On 9/1/15 12:49 PM, default0 wrote: Hello A simple thing I stumbled acros

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread drug via Digitalmars-d-learn
02.09.2015 00:08, Jonathan M Davis via Digitalmars-d-learn пишет: On Tuesday, September 01, 2015 20:05:18 drug via Digitalmars-d-learn wrote: My case is I don't know what type user will be using, because I write a library. What's the best way to process char[..] in this case? char[] should nev

Re: Casting away immutability

2015-09-01 Thread lobo via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 04:04:54 UTC, Sergei Degtiarev wrote: On Wednesday, 2 September 2015 at 02:50:30 UTC, Jonathan M Davis wrote: is undefined behavior. So, don't do it. I don't. Actually, I'm looking for opposite - to protect data, like it is a class with two methods, returning v

Re: Casting away immutability

2015-09-01 Thread Sergei Degtiarev via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 02:50:30 UTC, Jonathan M Davis wrote: is undefined behavior. So, don't do it. I don't. Actually, I'm looking for opposite - to protect data, like it is a class with two methods, returning void[] and immutable(void)[] as memory buffer, which user of the class s

Re: Casting away immutability

2015-09-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 02, 2015 02:04:58 Sergei Degtiarev via Digitalmars-d-learn wrote: > I can't understand how cast coexist with immutability. Consider > the code: > immutable immutable(int)[4] buf; > auto x=buf[0]; > auto p=buf.ptr; > > auto i=cast(int[]) buf; > i[]=1; > > assert(

Re: Casting away immutability

2015-09-01 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 02:05:00 UTC, Sergei Degtiarev wrote: I can't understand how cast coexist with immutability. Cast bypasses immutability, triggering implementation-defined behavior. You might modify immutable data, you might cause the program to crash, it might just not do a

Casting away immutability

2015-09-01 Thread Sergei Degtiarev via Digitalmars-d-learn
I can't understand how cast coexist with immutability. Consider the code: immutable immutable(int)[4] buf; auto x=buf[0]; auto p=buf.ptr; auto i=cast(int[]) buf; i[]=1; assert(buf.ptr == p); assert(buf[0] != x); I've just

Re: 2.068.0 std.process.executeShell how to set the shell?

2015-09-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 01:26:23 UTC, Jonathan M Davis wrote: [snip] https://issues.dlang.org/show_bug.cgi?id=15000 - Jonathan M Davis

Re: 2.068.0 std.process.executeShell how to set the shell?

2015-09-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 01, 2015 21:55:28 albatroz via Digitalmars-d-learn wrote: > Hi, since the upgrade to the latest version the function > executeShell (also the other functions), is not working has it > used to be, older versions of the compiler did not require any > change or setting the SHELL.

Re: Can we get a video tutorial?

2015-09-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 15:01:15 UTC, Stephen wrote: On Tuesday, 1 September 2015 at 14:50:53 UTC, cym13 wrote: On Tuesday, 1 September 2015 at 14:48:55 UTC, Stephen wrote: So I've been trying to install Dlang, VisualD, and Dub for the past day with little luck. I have DMD 1 and 2, and

Re: Access Violation while trying to use OpenGL

2015-09-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 20:35:43 UTC, spec00 wrote: On Tuesday, 1 September 2015 at 20:15:28 UTC, spec00 wrote: I'am trying to play a bit with D and OpenGL by using the available Derelict bindings, but i'am even failing to create a window. [...] The problem was in me using the 64bit

Prefer Signed or Unsigned in D?

2015-09-01 Thread John Carter via Digitalmars-d-learn
C/C++ discussion here http://blog.robertelder.org/signed-or-unsigned-part-2/ D rules here... http://dlang.org/type.html#integer-promotions

Profiling with LDC/GDC?

2015-09-01 Thread qznc via Digitalmars-d-learn
Is it possible to profile with LDC/GDC? At least LDC lists it as only an "idea". http://wiki.dlang.org/LDC_project_ideas

2.068.0 std.process.executeShell how to set the shell?

2015-09-01 Thread albatroz via Digitalmars-d-learn
Hi, since the upgrade to the latest version the function executeShell (also the other functions), is not working has it used to be, older versions of the compiler did not require any change or setting the SHELL. How to change the SHELL, that is used by executeShell? userShell will always retu

Re: Scoped Imports for Structs/Classes/Template Constraints

2015-09-01 Thread Enamex via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 21:17:10 UTC, jmh530 wrote: Consider these three different ways to import std.stdio import std.stdio; import std.stdio : writeln; static import std.stdio; and suppose writeln is the only function in std.stdio the program is using. In each case, the size of the e

Re: Scoped Imports for Structs/Classes/Template Constraints

2015-09-01 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 19:48:02 UTC, Enamex wrote: They aren't selective, yeah. But the rationale is good: There's not supposed to be any way to import modules with the same path so static importing means it's entirely and always unambiguous. I understand that a static import is alw

Re: Appenders and Arrays

2015-09-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/1/15 3:13 PM, Daniel Kozak via Digitalmars-d-learn wrote: Dne 1.9.2015 v 19:20 Steven Schveighoffer via Digitalmars-d-learn napsal(a): On 9/1/15 12:49 PM, default0 wrote: Hello A simple thing I stumbled across: int main() { import std.stdio; import std.range; int[] d;

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 01, 2015 20:05:18 drug via Digitalmars-d-learn wrote: > My case is I don't know what type user will be using, because I write a > library. What's the best way to process char[..] in this case? char[] should never be anything other than UTF-8. Similarly, wchar[] is UTF-16, and

Re: Access Violation while trying to use OpenGL

2015-09-01 Thread spec00 via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 20:15:28 UTC, spec00 wrote: I'am trying to play a bit with D and OpenGL by using the available Derelict bindings, but i'am even failing to create a window. [...] The problem was in me using the 64bit version of the GLFW dll. DMD doesn't support compiling to x

Access Violation while trying to use OpenGL

2015-09-01 Thread spec00 via Digitalmars-d-learn
I'am trying to play a bit with D and OpenGL by using the available Derelict bindings, but i'am even failing to create a window. At the moment my code is as simple as: - import derelict.glfw3.glfw3; import std.c.stdio : fputs, fputc, stderr; extern(C) no

Re: Scoped Imports for Structs/Classes/Template Constraints

2015-09-01 Thread Enamex via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 15:50:40 UTC, jmh530 wrote: I'm following some of your post, but not quite all of it (particularly the part at the end, and I also think static imports can't be selective). Anyway, I was thinking about something like below as one possible alternative struct T {

Re: Appenders and Arrays

2015-09-01 Thread Daniel Kozak via Digitalmars-d-learn
Dne 1.9.2015 v 19:20 Steven Schveighoffer via Digitalmars-d-learn napsal(a): On 9/1/15 12:49 PM, default0 wrote: Hello A simple thing I stumbled across: int main() { import std.stdio; import std.range; int[] d; d ~= 10; d ~= 20; d.put(5); writeln(d);

Re: Appenders and Arrays

2015-09-01 Thread default0 via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 17:20:49 UTC, Steven Schveighoffer wrote: On 9/1/15 12:49 PM, default0 wrote: Hello A simple thing I stumbled across: int main() { import std.stdio; import std.range; int[] d; d ~= 10; d ~= 20; d.put(5); writeln(d); retu

Re: Appenders and Arrays

2015-09-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/1/15 12:49 PM, default0 wrote: Hello A simple thing I stumbled across: int main() { import std.stdio; import std.range; int[] d; d ~= 10; d ~= 20; d.put(5); writeln(d); return 0; } Appenders work fine as output ranges, but arrays do not. The above

Re: Role of D in Python and performance computing [was post on using go 1.5 and GC latency]

2015-09-01 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 25 August 2015 at 05:12:55 UTC, Laeeth Isharc wrote: What's the best reference to learn more about PGAS? I've seen a few presentations, https://www.osc.edu/sites/osc.edu/files/staff_files/dhudak/pgas-tutorial.pdf http://www.inf.unideb.hu/~fazekasg/english/New_Programming_Paradims/

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread drug via Digitalmars-d-learn
My case is I don't know what type user will be using, because I write a library. What's the best way to process char[..] in this case?

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread Justin Whear via Digitalmars-d-learn
On Tue, 01 Sep 2015 19:40:24 +0300, drug wrote: > I'm just trying to automatically convert D types to hdf5 types so I > guess char[..] isn't obligatory some form of UTF-8 encoded text. Or I > should treat it so? Because of D's autodecoding it can be problematic to assume UTF-8 if other encodings

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Sep 01, 2015 at 07:40:24PM +0300, drug via Digitalmars-d-learn wrote: [...] > I'm just trying to automatically convert D types to hdf5 types so I > guess char[..] isn't obligatory some form of UTF-8 encoded text. Or I > should treat it so? In D, char[]/wchar[]/dchar[] are intended to be UT

Appenders and Arrays

2015-09-01 Thread default0 via Digitalmars-d-learn
Hello A simple thing I stumbled across: int main() { import std.stdio; import std.range; int[] d; d ~= 10; d ~= 20; d.put(5); writeln(d); return 0; } Appenders work fine as output ranges, but arrays do not. The above code prints "20" (ie the 10 is removed). Is

new static array

2015-09-01 Thread anonymous via Digitalmars-d-learn
Hello, I tried to send a string[4] with std.concurrency: import std.concurrency; import std.stdio; void fun() { receive((string[4] data) { writeln(data);}); } void main() { string[4] data; auto tid = spawn(&fun); send(tid, data); } I got (dmd 2.068) /usr/include

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread drug via Digitalmars-d-learn
On 01.09.2015 19:32, Justin Whear wrote: On Tue, 01 Sep 2015 16:25:53 +, Justin Whear wrote: On Tue, 01 Sep 2015 19:18:42 +0300, drug wrote: http://dpaste.dzfl.pl/4535c5c03126 Arrays of char are assumed to be UTF-8 encoded text and a single char is not necessarily sufficient to represen

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread Justin Whear via Digitalmars-d-learn
On Tue, 01 Sep 2015 16:25:53 +, Justin Whear wrote: > On Tue, 01 Sep 2015 19:18:42 +0300, drug wrote: > >> http://dpaste.dzfl.pl/4535c5c03126 > > Arrays of char are assumed to be UTF-8 encoded text and a single char is > not necessarily sufficient to represent a character. ElementType > ide

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread Justin Whear via Digitalmars-d-learn
On Tue, 01 Sep 2015 19:21:44 +0300, drug wrote: > On 01.09.2015 19:18, drug wrote: >> http://dpaste.dzfl.pl/4535c5c03126 > > Should I use ForeachType!(char[3]) instead of ElementType? Try std.range.ElementEncodingType

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread Justin Whear via Digitalmars-d-learn
On Tue, 01 Sep 2015 19:18:42 +0300, drug wrote: > http://dpaste.dzfl.pl/4535c5c03126 Arrays of char are assumed to be UTF-8 encoded text and a single char is not necessarily sufficient to represent a character. ElementType identifies the type that you will receive when (for instance) foreachin

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread drug via Digitalmars-d-learn
On 01.09.2015 19:18, drug wrote: http://dpaste.dzfl.pl/4535c5c03126 Should I use ForeachType!(char[3]) instead of ElementType?

Why ElementType!(char[3]) == dchar instead of char?

2015-09-01 Thread drug via Digitalmars-d-learn
http://dpaste.dzfl.pl/4535c5c03126

Re: Scoped Imports for Structs/Classes/Template Constraints

2015-09-01 Thread jmh530 via Digitalmars-d-learn
On Monday, 31 August 2015 at 23:36:25 UTC, Enamex wrote: I'm not sure whether a naked 'local.S' should work; sometimes it does and sometimes it doesn't. But an `static import local;` then `voidfoo(local.S)` definitely works. `static import` forces the imported symbols to be fully qualified on

Re: Can we get a video tutorial?

2015-09-01 Thread Stephen via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 14:50:53 UTC, cym13 wrote: On Tuesday, 1 September 2015 at 14:48:55 UTC, Stephen wrote: So I've been trying to install Dlang, VisualD, and Dub for the past day with little luck. I have DMD 1 and 2, and VisualD installed, but I can't get Dub working. Are you on

Re: Can we get a video tutorial?

2015-09-01 Thread cym13 via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 14:48:55 UTC, Stephen wrote: So I've been trying to install Dlang, VisualD, and Dub for the past day with little luck. I have DMD 1 and 2, and VisualD installed, but I can't get Dub working. Are you on linux or windows or...? Please, give a bit of context.

Can we get a video tutorial?

2015-09-01 Thread Stephen via Digitalmars-d-learn
So I've been trying to install Dlang, VisualD, and Dub for the past day with little luck. I have DMD 1 and 2, and VisualD installed, but I can't get Dub working. I finally asked a friend to help and he got me to my current point of maybe having a package working but I'm not sure because I'm get

Re: Role of D in Python and performance computing [was post on using go 1.5 and GC latency]

2015-09-01 Thread via Digitalmars-d-learn
More info on the Go 1.5 concurrent GC, a classic one: https://blog.golang.org/go15gc

Re: Definition of SIGRTMIN

2015-09-01 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 04:55:38 UTC, Andre wrote: Is there s.th. wrong with the definition? Yeah, I think so. It is: private extern (C) nothrow @nogc { int __libc_current_sigrtmin(); int __libc_current_sigrtmax(); } alias __libc_current_sigrtmin SIGRTM

Re: MmFile : Is this std.mmFile BUG?

2015-09-01 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 26 August 2015 at 17:30:29 UTC, Alex Parrill wrote: it shouldn't segfault though. The segfault is because of: https://issues.dlang.org/show_bug.cgi?id=14993 It "should've" been an InvalidMemoryOperationError, which in turn was caused by: https://issues.dlang.org/show_bug.cgi?

Re: Safe copy-paste using mixin

2015-09-01 Thread drug via Digitalmars-d-learn
On 31.08.2015 16:30, cym13 wrote: No, in my case there is no problem, I'm curious. I guess that string mixins sometimes may look like a hack. IMHO they are a hack. That's why they should be used with caution (and why using them feels so good ^_^ ). But I don't see how mixing arbitrary code inst