Re: execute bash?

2016-04-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 10 April 2016 at 00:47:28 UTC, Puming wrote: 3. when hiting 'vim a.file' on the command, things go messy. Have you got these interactive commands work in dexpect? It is surely capturing exactly what vim sends to a terminal, which is primarily a series of control sequences to draw

Re: Why do my stack traces look like this? How can I get more informative ones?

2016-04-09 Thread pineapple via Digitalmars-d-learn
On Sunday, 10 April 2016 at 00:48:23 UTC, pineapple wrote: How can I fix this, and get something human-readable? Oh, answered my own question. Appending the -g flag to dmd options makes the stack trace much prettier.

Why do my stack traces look like this? How can I get more informative ones?

2016-04-09 Thread pineapple via Digitalmars-d-learn
I'm getting a RangeError and the stack trace is being spectacularly unhelpful in debugging the problem, because it looks like this: core.exception.RangeError@E:\Dropbox\Projects\d\lib\wip_ansi_2.d(78): Range violation 0x0040A240 0x00402E37 0x00402B5E 0x00402985 0x00402F29

Re: execute bash?

2016-04-09 Thread Puming via Digitalmars-d-learn
On Saturday, 9 April 2016 at 08:56:17 UTC, wobbles wrote: On Friday, 8 April 2016 at 23:06:06 UTC, Puming wrote: On Friday, 8 April 2016 at 18:23:32 UTC, wobbles wrote: On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried

Re: Practical difference between a struct with const members and with mutable members?

2016-04-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, April 09, 2016 16:07:36 pineapple via Digitalmars-d-learn wrote: > I'm mainly coming from languages that haven't got structs, let > alone the kind of differentiation D offers between > mutable/immutable/const/etc variables, so I'm still trying to > work out just when to use each -

Re: Fiber and Thread Communication

2016-04-09 Thread Ali Çehreli via Digitalmars-d-learn
On 04/09/2016 07:45 AM, Nordlöw wrote: > On Friday, 8 April 2016 at 10:51:49 UTC, Nordlöw wrote: > AFAICT, it is not clear what are the limitations of the current > std.concurrency and, from what. An illustrating example on task-based > parallellism (such as the ones in jin.go) should partly

Re: Fiber and Thread Communication

2016-04-09 Thread Ali Çehreli via Digitalmars-d-learn
On 04/08/2016 02:42 PM, Dicebot wrote: >> Thanks Dicebot. I don't think the included >> std.concurrency.FiberScheduler has support for message passing because >> FiberScheduler.spawn does not return a Tid. If so, I don't see how >> it's possible to send messages between fibers. >> >> Ali > >

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On Saturday, 9 April 2016 at 19:31:31 UTC, Uranuz wrote: I think that we need to add warning about such case in documentation section: https://dlang.org/spec/hash-map.html#construction_and_ref_semantic in order to prevent this kind of mistakes in code. Isn't that exactly what the section you

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On Saturday, 9 April 2016 at 19:25:32 UTC, Uranuz wrote: Another observation is illustrated with the foloving code: http://dpaste.dzfl.pl/8d68fd5922b7 Because AA and arrays are not created before they were assigned some value it leads to inconsistency in behavior. And will produce unexpected

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 19:25:32 UTC, Uranuz wrote: On Saturday, 9 April 2016 at 18:27:11 UTC, ag0aep6g wrote: [...] Another observation is illustrated with the foloving code: http://dpaste.dzfl.pl/8d68fd5922b7 Because AA and arrays are not created before they were assigned some value

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 18:27:11 UTC, ag0aep6g wrote: On Saturday, 9 April 2016 at 18:06:52 UTC, Uranuz wrote: Thanks. It's clear now. AA holds not `array struct` itself inside, but pointer to it. How the array is stored in the AA doesn't matter, as far as I can see. The point is that

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On Saturday, 9 April 2016 at 18:06:52 UTC, Uranuz wrote: Thanks. It's clear now. AA holds not `array struct` itself inside, but pointer to it. How the array is stored in the AA doesn't matter, as far as I can see. The point is that you obtain a pointer to the array struct in the AA, not a

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
On Saturday, 9 April 2016 at 16:44:06 UTC, ag0aep6g wrote: On 09.04.2016 18:13, Uranuz wrote: http://dpaste.dzfl.pl/523781df67ab For reference, the code: import std.stdio; void main() { string[][string] mapka; string[]* mapElem = "item" in mapka; //Checking if I

Re: Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On 09.04.2016 18:13, Uranuz wrote: http://dpaste.dzfl.pl/523781df67ab For reference, the code: import std.stdio; void main() { string[][string] mapka; string[]* mapElem = "item" in mapka; //Checking if I have item if( !mapElem )

Re: Practical difference between a struct with const members and with mutable members?

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On 09.04.2016 18:07, pineapple wrote: What's different between these two examples, practically speaking? When would you use one over the other? struct thing1{ const int x, y; } struct thing2{ int x, y; } In this case, const is practically the same as immutable. But immutable is

Stupid question about AA. The following code works but I don't undrstand why?!

2016-04-09 Thread Uranuz via Digitalmars-d-learn
I am stupid today :) So I have a question. The piece of code given: http://dpaste.dzfl.pl/523781df67ab It looks good, but I don't understand why it works?

Practical difference between a struct with const members and with mutable members?

2016-04-09 Thread pineapple via Digitalmars-d-learn
I'm mainly coming from languages that haven't got structs, let alone the kind of differentiation D offers between mutable/immutable/const/etc variables, so I'm still trying to work out just when to use each - What's different between these two examples, practically speaking? When would you use

Re: Fiber and Thread Communication

2016-04-09 Thread Nordlöw via Digitalmars-d-learn
On Friday, 8 April 2016 at 10:51:49 UTC, Nordlöw wrote: Are there any plans to unite AFAICT, it is not clear what are the limitations of the current std.concurrency and, from what. An illustrating example on task-based parallellism (such as the ones in jin.go) should partly alleviate this

Re: foreach of classes

2016-04-09 Thread Basile B. via Digitalmars-d-learn
On Saturday, 9 April 2016 at 11:03:54 UTC, Nicholas Wilson wrote: On Saturday, 9 April 2016 at 10:56:34 UTC, Lucien wrote: On Saturday, 9 April 2016 at 10:28:05 UTC, Basile B. wrote: On Saturday, 9 April 2016 at 10:10:19 UTC, Lucien wrote: Hello. FYI the things that you can put there (in

Re: foreach of classes

2016-04-09 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 9 April 2016 at 10:56:34 UTC, Lucien wrote: On Saturday, 9 April 2016 at 10:28:05 UTC, Basile B. wrote: On Saturday, 9 April 2016 at 10:10:19 UTC, Lucien wrote: Hello. When I do: - class MyClass{..} class YourClass{..} class OurClass{..} YourClass yc = new

Re: foreach of classes

2016-04-09 Thread Lucien via Digitalmars-d-learn
On Saturday, 9 April 2016 at 10:28:05 UTC, Basile B. wrote: On Saturday, 9 April 2016 at 10:10:19 UTC, Lucien wrote: Hello. When I do: - class MyClass{..} class YourClass{..} class OurClass{..} YourClass yc = new YourClass(); foreach (auto id; [ typeid(MyClass),

Re: foreach of classes

2016-04-09 Thread Basile B. via Digitalmars-d-learn
On Saturday, 9 April 2016 at 10:10:19 UTC, Lucien wrote: Hello. When I do: - class MyClass{..} class YourClass{..} class OurClass{..} YourClass yc = new YourClass(); foreach (auto id; [ typeid(MyClass), typeid(YourClass), typeid(OurClass) ]) { if (typeid(yc) == id)

foreach of classes

2016-04-09 Thread Lucien via Digitalmars-d-learn
Hello. When I do: - class MyClass{..} class YourClass{..} class OurClass{..} YourClass yc = new YourClass(); foreach (auto id; [ typeid(MyClass), typeid(YourClass), typeid(OurClass) ]) { if (typeid(yc) == id) { writeln("It works !"); } } -

Re: Interfaces

2016-04-09 Thread alexander Patapoff via Digitalmars-d-learn
On Saturday, 9 April 2016 at 08:59:13 UTC, ag0aep6g wrote: On 09.04.2016 10:45, alexander Patapoff wrote: [...] There is a somewhat obscure feature which lets you declare and instantiate a class at the same time: interface Action { void actions(int x); } void main() { Action

Re: Interfaces

2016-04-09 Thread ag0aep6g via Digitalmars-d-learn
On 09.04.2016 10:45, alexander Patapoff wrote: is there a way for me to do this in D? In java, one is able to create a new instance of an interface. interface Action { void actions(T t); } class testAction { this() { Action action = new Action() { void

Re: execute bash?

2016-04-09 Thread wobbles via Digitalmars-d-learn
On Friday, 8 April 2016 at 23:06:06 UTC, Puming wrote: On Friday, 8 April 2016 at 18:23:32 UTC, wobbles wrote: On Friday, 8 April 2016 at 16:07:13 UTC, Adam D. Ruppe wrote: On Friday, 8 April 2016 at 15:20:09 UTC, Puming wrote: I tried with signal, but didn't catch SIGTTOU, it seems that

Interfaces

2016-04-09 Thread alexander Patapoff via Digitalmars-d-learn
is there a way for me to do this in D? In java, one is able to create a new instance of an interface. interface Action { void actions(T t); } class testAction { this() { Action action = new Action() { void actions(T t){...} } } } I found this feature

Re: Is it legal to use std.windows modules?

2016-04-09 Thread zabruk70 via Digitalmars-d-learn
On Saturday, 9 April 2016 at 02:14:48 UTC, Jonathan M Davis wrote: So, if anything, I'd open a bug report about how std.windows is old bug https://issues.dlang.org/show_bug.cgi?id=13516