Re: What is the exact meaning of 'nothrow'?

2015-06-10 Thread Mike via Digitalmars-d-learn
On Thursday, 11 June 2015 at 00:27:36 UTC, Ali Çehreli wrote: "Note: Remember that it is not recommended to catch Error nor its base class Throwable. What I mean by "any exception" here is "any exception that is defined under the Exception hierarchy." A nothrow function can still emit exceptio

Re: What is the exact meaning of 'nothrow'?

2015-06-10 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 11 June 2015 at 00:27:36 UTC, Ali Çehreli wrote: On 06/10/2015 05:06 PM, Yuxuan Shui wrote: I want to know exactly what is considered to be 'throw'. I'm able to use dynamic arrays (which can throw 'Range violation') and asserts in a nothrow function. Shouldn't those be considered

Re: dmd and string imports on Windows

2015-06-10 Thread Baz via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 19:59:17 UTC, Atila Neves wrote: On Linux: foo.d: import std.stdio; void main() { writeln(import("dir/bar.txt")); } dmd -J. foo.d # ok On Windows: Error: file "dir/bar.txt" cannot be found or not in a path specified with -J I tried the obvious buildPath("dir",

Re: DFL background tasks

2015-06-10 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 22:18:21 UTC, Scroph wrote: client.perform; while(!client.isStopped) I don't think this will work as you expect. "perform" is a synchronous call, it will not return until the download finishes, as I understand, so your while loop is too late. I th

Re: What is the exact meaning of 'nothrow'?

2015-06-10 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 11 June 2015 at 00:32:45 UTC, ZombineDev wrote: Environment exceptions are stuff like user input and network and file access. This are problems that you generally want to ... These* are ... handle and that's why they're considered recoverable. So 'Exception's propagate through fun

Re: What is the exact meaning of 'nothrow'?

2015-06-10 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 11 June 2015 at 00:06:24 UTC, Yuxuan Shui wrote: I want to know exactly what is considered to be 'throw'. I'm able to use dynamic arrays (which can throw 'Range violation') and asserts in a nothrow function. Shouldn't those be considered 'throw'? In D there are two types of exce

Re: What is the exact meaning of 'nothrow'?

2015-06-10 Thread Ali Çehreli via Digitalmars-d-learn
On 06/10/2015 05:06 PM, Yuxuan Shui wrote: I want to know exactly what is considered to be 'throw'. I'm able to use dynamic arrays (which can throw 'Range violation') and asserts in a nothrow function. Shouldn't those be considered 'throw'? Yes, the documentation is minimal: :) http://dlang

What is the exact meaning of 'nothrow'?

2015-06-10 Thread Yuxuan Shui via Digitalmars-d-learn
I want to know exactly what is considered to be 'throw'. I'm able to use dynamic arrays (which can throw 'Range violation') and asserts in a nothrow function. Shouldn't those be considered 'throw'?

Re: What is D's minimum requirements on Mac?

2015-06-10 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 20:18:06 UTC, Laeeth Isharc wrote: On Wednesday, 10 June 2015 at 18:55:27 UTC, Adam D. Ruppe wrote: I'm still tempted to grab a used Mac so I can port my display stuff to Cocoa and test it, but Macs are outrageously expensive and I hate them, so want to spend as li

Re: Debugging D in MonoDevelop, finding multiple gdb processes?

2015-06-10 Thread michaelc37 via Digitalmars-d-learn
i am assuming you are using the built in gdb debugger. a) you can try using this addin Gdb.D instead -https://github.com/llucenic/MonoDevelop.Debugger.Gdb.D it might be also be in the monodevelop beta repos. b) you can "fix"/work around the issue by replacing "Syscall.kill" in the source (ht

Re: DFL background tasks

2015-06-10 Thread Scroph via Digitalmars-d-learn
Briliant, thanks a lot ! Looks like I misunderstood Adam's reply, sorry about that ! I tried different things but I didn't think of calling invoke from within the worker thread, that solved the freezing problem. I ended up using the Thread class; spawn complained about the mutability of the g

Re: Writeln does not prints if array has more than 500 elements

2015-06-10 Thread jklp via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 21:49:56 UTC, kerdemdemir wrote: ==> NOTHİNG PRINTS What am I doing wrong? Which OS, which terminal ?

Re: Writeln does not prints if array has more than 500 elements

2015-06-10 Thread kerdemdemir via Digitalmars-d-learn
I am running DMD on windows, my DMD version is DMD32 V2.067.1. It might be because I installed 32bit version on 64bit windows.

Re: Shortest way to allocate an array and initialize it with a specific value.

2015-06-10 Thread Ali Çehreli via Digitalmars-d-learn
On 06/10/2015 01:22 PM, Adel Mamin wrote: ubyte[5] a = 0xAA; // Fine. Five 0xAA bytes. auto a2 = new ubyte[5]; // Fine. Five 0 bytes. Now, let's say, I want to allocate an array of a size, derived at run time, and initialize it to some non-zero value at the same time. What would be the shortest w

Re: Writeln does not prints if array has more than 500 elements

2015-06-10 Thread Ali Çehreli via Digitalmars-d-learn
On 06/10/2015 02:49 PM, kerdemdemir wrote: Hi Following code works int[] peopleMoney = iota(0, 500, 1).array(); writeln(peopleMoney.map!(a => to!string(a)).joiner(" ")); => 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ... It writes the contents to std.output as expected

Writeln does not prints if array has more than 500 elements

2015-06-10 Thread kerdemdemir via Digitalmars-d-learn
Hi Following code works int[] peopleMoney = iota(0, 500, 1).array(); writeln(peopleMoney.map!(a => to!string(a)).joiner(" ")); => 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ... It writes the contents to std.output as expected. But if I change 500 to 600 nothing is

Re: Shortest way to allocate an array and initialize it with a specific value.

2015-06-10 Thread Michael Coulombe via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 20:22:18 UTC, Adel Mamin wrote: ubyte[5] a = 0xAA; // Fine. Five 0xAA bytes. auto a2 = new ubyte[5]; // Fine. Five 0 bytes. Now, let's say, I want to allocate an array of a size, derived at run time, and initialize it to some non-zero value at the same time. What w

Debugging D in MonoDevelop, finding multiple gdb processes?

2015-06-10 Thread Rodger Beats via Digitalmars-d-learn
I'm new to the language and new to using MonoDevelop and I've got this persistent problem that I haven't been able to solve with Google searching. I frequently test out my code as I write it and every time I start it up a new gdb process will start running but not terminate at the end of the pr

Re: Shortest way to allocate an array and initialize it with a specific value.

2015-06-10 Thread Low Functioning via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 20:22:18 UTC, Adel Mamin wrote: ubyte[5] a = 0xAA; // Fine. Five 0xAA bytes. auto a2 = new ubyte[5]; // Fine. Five 0 bytes. Now, let's say, I want to allocate an array of a size, derived at run time, and initialize it to some non-zero value at the same time. What w

Shortest way to allocate an array and initialize it with a specific value.

2015-06-10 Thread Adel Mamin via Digitalmars-d-learn
ubyte[5] a = 0xAA; // Fine. Five 0xAA bytes. auto a2 = new ubyte[5]; // Fine. Five 0 bytes. Now, let's say, I want to allocate an array of a size, derived at run time, and initialize it to some non-zero value at the same time. What would be the shortest way of doing it?

Re: What is D's minimum requirements on Mac?

2015-06-10 Thread Laeeth Isharc via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 18:55:27 UTC, Adam D. Ruppe wrote: I'm still tempted to grab a used Mac so I can port my display stuff to Cocoa and test it, but Macs are outrageously expensive and I hate them, so want to spend as little as possible. What does dmd minimally require on a mac? If I

Re: What is D's minimum requirements on Mac?

2015-06-10 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-06-10 18:55:26 +, Adam D. Ruppe said: I'm still tempted to grab a used Mac so I can port my display stuff to Cocoa and test it, but Macs are outrageously expensive and I hate them, so want to spend as little as possible. Well, I would go at least for a 64-bit system. Otherwise eve

Re: dmd and string imports on Windows

2015-06-10 Thread Yuxuan Shui via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 19:59:17 UTC, Atila Neves wrote: On Linux: foo.d: import std.stdio; void main() { writeln(import("dir/bar.txt")); } dmd -J. foo.d # ok On Windows: Error: file "dir/bar.txt" cannot be found or not in a path specified with -J I tried the obvious buildPath("dir",

Re: Is it possible to add items to the arrays and hashes at compile time?

2015-06-10 Thread Dennis Ritchie via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 17:43:36 UTC, Ali Çehreli wrote: On the other hand, if it's a manifest constant (enum, const static, etc.) then by definition it cannot be mutated. If we allowed mutation of compile-time expressions, then we would have a complicated language. Unfortunately, the h

dmd and string imports on Windows

2015-06-10 Thread Atila Neves via Digitalmars-d-learn
On Linux: foo.d: import std.stdio; void main() { writeln(import("dir/bar.txt")); } dmd -J. foo.d # ok On Windows: Error: file "dir/bar.txt" cannot be found or not in a path specified with -J I tried the obvious buildPath("dir", "bar.txt") instead and now: Error: file "dir\\bar.d" cannot be

Re: Is it possible to add items to the arrays and hashes at compile time?

2015-06-10 Thread Dennis Ritchie via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 17:13:34 UTC, anonymous wrote: On Wednesday, 10 June 2015 at 17:00:34 UTC, Dennis Ritchie wrote: Isnt it possible to come up with the interpreter compile-time, which will determine the operating time of the program at runtime at compile time. Sounds like the halt

What is D's minimum requirements on Mac?

2015-06-10 Thread Adam D. Ruppe via Digitalmars-d-learn
I'm still tempted to grab a used Mac so I can port my display stuff to Cocoa and test it, but Macs are outrageously expensive and I hate them, so want to spend as little as possible. What does dmd minimally require on a mac? If I got like a 10.5 would that work? i'm considering something lik

Re: Is it possible to add items to the arrays and hashes at compile time?

2015-06-10 Thread Ali Çehreli via Digitalmars-d-learn
On 06/10/2015 10:00 AM, Dennis Ritchie wrote: Is it possible somehow to create a more complex compilation process, which can reassign variables more than once? I am not a compiler writer but I assume if a variable is not a compile-time expression, then the compiler generates code that makes i

Re: Is it possible to add items to the arrays and hashes at compile time?

2015-06-10 Thread anonymous via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 17:00:34 UTC, Dennis Ritchie wrote: Isnt it possible to come up with the interpreter compile-time, which will determine the operating time of the program at runtime at compile time. Sounds like the halting problem. So, no, generally this is not possible.

Re: Is it possible to add items to the arrays and hashes at compile time?

2015-06-10 Thread Dennis Ritchie via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 07:15:26 UTC, Ali Çehreli wrote: My phrasing was off: By definition, initialization happens once. :) What I meant is, once initialized, a compile-time variable cannot be reassigned. The reason is, to effect compile time evaluation, one needs to use 'enum' (or 'stat

Re: Utf8 to Utf32 cast cost

2015-06-10 Thread Marco Leise via Digitalmars-d-learn
Am Mon, 8 Jun 2015 12:59:31 +0200 schrieb Daniel Kozák via Digitalmars-d-learn : > > On Mon, 08 Jun 2015 10:41:59 + > Kadir Erdem Demir via Digitalmars-d-learn > wrote: > > > I want to use my char array with awesome, cool std.algorithm > > functions. Since many of this algorithms requires

Re: Utf8 to Utf32 cast cost

2015-06-10 Thread Marco Leise via Digitalmars-d-learn
Am Mon, 08 Jun 2015 11:13:25 + schrieb "Daniel Kozak" : > BTW on ldc(ldc -O3 -singleobj -release -boundscheck=off) > transcode is the fastest: > > f0 time: 1 sec, 115 ms, 48 μs, and 7 hnsecs // to!dstring > f1 time: 449 ms and 329 μs // toUTF32 > f2 time: 272 ms, 969 μs, and 1 hnsec // trans

Re: rt_finalize question

2015-06-10 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 00:04:16 UTC, Oleg B wrote: Why it's extern(C)? For easy linking. What must do collectHandler function? Looks like it overrides the destruction procedure. If I understand correctly monitor relates to multithreading control (Mutex?). Yes.

Re: Is it possible to add items to the arrays and hashes at compile time?

2015-06-10 Thread Ali Çehreli via Digitalmars-d-learn
On 06/09/2015 09:36 PM, Dennis Ritchie wrote: > But I can not do so: > > enum int[][int][int] ctHash = init_ctHash(5); > > ctHash = merge(ctHash, init_ctHash(6)); > > I have a question: why variables may not be initialized more than once? > Why can't they to resave at compile time? My phrasing w