Re: Increasing D's visibility

2014-09-16 Thread Martin Drasar via Digitalmars-d
On 16.9.2014 20:07, Anonymous via Digitalmars-d wrote: Dlang on 4chan http://boards.4chan.org/g/thread/44196390/dlang Yeah, and the discussion is just in line with typical 4chan discussions :-) A1) Andrei is fucking hot and he's not russian A2) @A1: Andrei will never be your husbando Why

Re: Slightly OT - Survey

2014-09-01 Thread Martin Drasar via Digitalmars-d
On 1.9.2014 0:11, Rikki Cattermole via Digitalmars-d wrote: As part of my Degree in ICT at CPIT, I do a largish project at the end. Called Industry project. My own is in house, which I proposed. Essentially its a web service to aid learning. It would really help me if anyone who falls under

Re: Simplified signatures in generated documentation

2014-08-20 Thread Martin Drasar via Digitalmars-d
On 20.8.2014 9:04, Jacob Carlborg via Digitalmars-d wrote: Looking at the documentation for std.algorithm and the std.logger (currently under review) [1] I think the function signatures look absolutely horrible. The functions std.algorithm in have complicated template constraints and in

readln() blocks file operations on windows

2014-07-31 Thread Martin Drasar via Digitalmars-d
Hi, consider this code: import std.stdio; import std.concurrency; import core.thread; void tryOpen() { Thread.sleep(2.seconds); try { auto f = File(nonexistent); } catch (Exception e) { writeln(Could not open a file); } } void main() { spawn(tryOpen); readln(); } On

Re: readln() blocks file operations on windows

2014-07-31 Thread Martin Drasar via Digitalmars-d
On 31.7.2014 20:37, FreeSlave via Digitalmars-d wrote: Note that output to stdout is not good choice to check event order, because it's buffered. Try to flush stdout or write to stderr. Maybe it's actual problem. Hi, this is just for illustration, although I think that writeln flushes itself.

Re: Tracing down core.exception.InvalidMemoryOperationError

2014-07-28 Thread Martin Drasar via Digitalmars-d-learn
On 28.7.2014 14:09, Joakim via Digitalmars-d-learn wrote: More broadly speaking, it is thrown whenever certain memory operations are attempted while the GC is running, 6 in all, as you can see here: https://github.com/D-Programming-Language/druntime/blob/master/src/gc/gc.d#L458 I believe

Re: Real time captioning of D presentations

2014-06-03 Thread Martin Drasar via Digitalmars-d-announce
On 3.6.2014 7:55, simendsjo via Digitalmars-d-announce wrote: Or because somebody in the production studio decided the music and sound effects needed to be at least 2x louder than the dialog. (...) I was about to say the exact same thing. I always have to turn the volume way down to not

Re: Dart and D: features that could be used in D, D-dart for web programming

2014-02-27 Thread Martin Drasar
On 27.2.2014 20:54, w0rp wrote: I developed 99% of the JavaScript part of an application for a year, and I have extensive JavaScript knowledge. After all that, I wrote this. https://w0rp.com/blog/post/javascript-sucks/ I think it was someone on Slashdot who posted this wonderful comment:

Re: Everyone who writes safety critical software should read this

2013-10-31 Thread Martin Drasar
On 31.10.2013 19:46, Walter Bright wrote: On 10/31/2013 9:00 AM, eles wrote: Basically, I think that critical code is almost always developed as if being transaction-based. It succeeds or it leaves no trace. That's great for the software. What if the hardware fails? Such as a bad memory

Re: Early review of std.logger

2013-10-14 Thread Martin Drasar
Having skimmed through the docs I noticed that there are three features missing that I use and would like to see in standard logger. First is the ability to write to several loggers at once, the second is optional formatting of log output and the third is an option to tell logger to log only one

Re: Early review of std.logger

2013-10-14 Thread Martin Drasar
On 14.10.2013 15:18, Robert Schadek wrote: On 10/14/2013 02:32 PM, Martin Drasar wrote: 1) MultiLogger class that takes references to other loggers and just forwards the call to the log function. will be done, see the reply to Sönke's post. Cool 2) Optional string parameter that describes

Re: Early review of std.logger

2013-10-14 Thread Martin Drasar
On 14.10.2013 15:43, Robert Schadek wrote: On 10/14/2013 03:31 PM, Martin Drasar wrote: Yes, but you have to lookup the formatting parameter, which adds some complexity. It would also a time complexity for each logging call, because you would have to parse the format. IMO KISS. Ok, let's have

Re: Hacker News Poll

2013-10-11 Thread Martin Drasar
On 11.10.2013 13:12, Gary Willoughby wrote: On Thursday, 10 October 2013 at 13:03:52 UTC, qznc wrote: There is a poll about programming languages on Hacker News. Of course, it is totally bogus, but it might be a nice opportunity to get people talking about D. ;)

Re: Trouble creating bidirectional range

2013-09-30 Thread Martin Drasar
On 29.9.2013 23:19, Timon Gehr wrote: Mark 'save' with @property and it will work. Well, d'oh! It really works now, thanks Timon. And the documentation does not call it as a function anywhere. But... having save a property seems counterintuitive, at least on semantic level. Martin

Re: Trouble creating bidirectional range

2013-09-30 Thread Martin Drasar
On 30.9.2013 8:28, monarch_dodra wrote: Too late to change it now, but agreed. The new property rules mean you can easily make it a non-property and break nothing, but calling save with parrens in generic code will not be possible. I don't doubt there is a good reason, however it should be

static this () executed multiple times

2013-09-30 Thread Martin Drasar
Hi, I have a module level static this() that I thought should be executed only once per pogram run. However, in my case it is executed 13 times. Question is - is this a normal behavior that I should work with or is there something wrong going on? Thanks, Martin

Re: static this () executed multiple times

2013-09-30 Thread Martin Drasar
On 30.9.2013 18:12, Adam D. Ruppe wrote: Is your program using threads? I believe static this is run once per thread, with shared static this being the once per program one. Yup, that did the trick. Thanks. Martin

Trouble creating bidirectional range

2013-09-29 Thread Martin Drasar
Hi, I have upgraded to dmd 2.063.2 and have some troubles making my custom bidirectional range work (it used to). In fact, even this code fails on assert and I am not really sure why... import std.range; struct MyRange(T) { private: T[] data; public: T front() @property { return

Re: Trouble creating bidirectional range

2013-09-29 Thread Martin Drasar
On 29.9.2013 22:45, Andrej Mitrovic wrote: On Sunday, 29 September 2013 at 20:42:20 UTC, Andrej Mitrovic wrote: On Sunday, 29 September 2013 at 20:37:13 UTC, Martin Drasar wrote: static assert(is(typeof(tmp.save) == MyRange!string)); You should call it like this: static assert(is(typeof

Re: Designing with the GC out of mind

2013-08-06 Thread Martin Drasar
On 6.8.2013 14:58, QAston wrote: On Tuesday, 6 August 2013 at 12:41:26 UTC, Adam D. Ruppe wrote: On Tuesday, 6 August 2013 at 07:19:40 UTC, JS wrote: 1. Is there a way to determine what the GC is doing? ... You can also tell where the gc runs by carefully reviewing the code: There's

Re: Question about auto ref

2013-03-29 Thread Martin Drasar
On 29.3.2013 11:59, Namespace wrote: Ok I interpret this as a rejection of the idea. This seems like a language design decision and as such would get much broader audience (and probably more responses) in digitalmars.D than in learn forum. Threads in here can get overlooked easily. Maybe you

Re: Exiting blocked threads (socket.accept)

2013-03-28 Thread Martin Drasar
On 28.3.2013 11:23, Tim wrote: Thanks Martin and Ali. Your solution works as long as I use the receive()-method, but what about using SocketStreams? I replaced socket.receive() with socketStream.readLine() which isn't broken by the solution above... If you check the documentation, you will

Re: std.asio?

2013-03-12 Thread Martin Drasar
On 11.3.2013 17:57, Robert wrote: On Mon, 2013-03-11 at 17:06 +0100, Martin Drasar wrote: I had plans to implement something like this, but at the moment I am stuck with other important things. I absolutely agree that something like boost::asio::io_service should be part of the standard

std.asio?

2013-03-11 Thread Martin Drasar
Hi, I started to work on a networking heavy project and I found out that there is nothing like boost.asio in D's standard library. So I looked around and discovered that vibe.d has nice fiber-based asynchronous library, but sadly it does not play along well with threads. Then I looked some more

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread Martin Drasar
On 22.1.2013 11:08, monarch_dodra wrote: I was trying to do a simple program to test message passing. Basically, I have 1 owner, and 2 slave threads. I'm facing two problems: 1 ) First, I want the slaves to be informed of when the master dies in an abnormal way. TDPL suggest

Re: Atomic updates

2013-01-22 Thread Martin Drasar
On 22.1.2013 16:00, bearophile wrote: Do you know why the site doesn't show the ddocs here? http://dlang.org/phobos/core_atomic.html Wild guess, but couldn't it be because the ddoc documentation is inside version(CoreDdoc) and not processed? Martin

Re: Passing shared delegates

2013-01-17 Thread Martin Drasar
On 16.1.2013 22:53, Maxim Fomin wrote: Yes, it happens so (shared function made it a member). Casting away shared is UB but it can be done if your are sure. Ok. But that leaves me with an unanswered question from one of my previous posts. What happens when you cast from and to shared? Is there

Re: Passing shared delegates

2013-01-17 Thread Martin Drasar
On 17.1.2013 12:56, Maxim Fomin wrote: Casting away shared in undefined behavior. Although it may be not written explicitly in dlang.org, once D will have a standard like C or C++, it will be name like so. In practice this means that behavior of program is uncertain and may result in many

Re: Passing shared delegates

2013-01-16 Thread Martin Drasar
Okay, I have hit another thing when dealing with shared delegates. Consider this code: alias void delegate (B b) shared Callback; class A { private B _b; this (B b) { _b = b; } void callback (B b) shared { b.execute(callback); //_b.execute(callback); --

Re: Passing shared delegates

2013-01-14 Thread Martin Drasar
On 14.1.2013 8:56, Maxim Fomin wrote: Which compiler version do you use? It compiles on 2.061. It was 2.060. It compiles now on 2.061. Great! In case of applying attributes to functions, mostly it is irrelevant whether it stands first or last. So, void foo() shared {} and shared void

Re: Undefined identifier WIN32_FILE_ATTRIBUTE_DATA

2012-11-14 Thread Martin Drasar
On 14.11.2012 15:28, Regan Heath wrote: Well.. druntime is built into a lib, and phobos is built using that lib. So, the only way I can imagine reproducing this error is by altering dmd2\src\druntime\import\core\sys\windows\windows.d, rebuilding druntime, then rebuilding phobos and replacing

Re: Undefined identifier WIN32_FILE_ATTRIBUTE_DATA

2012-11-13 Thread Martin Drasar
On 13.11.2012 12:41, Regan Heath wrote: Hi Regan, rdmd --eval=import std.file; --main Environment: DMD32 D Compiler v2.060, Windows 7 Pro 32bit I get no errors, in fact I get no output at all from that command line. Environment: DMD32 D Compiler v2.060, Windows 7 Pro 64bit R Hmm,

Re: Undefined identifier WIN32_FILE_ATTRIBUTE_DATA

2012-11-13 Thread Martin Drasar
On 13.11.2012 15:00, Regan Heath wrote: Curiouser and curiouser. In my case I had (re)built phobos/druntime so, suspecting it might be causing issues I download a fresh copy of the installer, moved my old installation folder and replaced it with the new one. I still don't get any

Re: 48 hour game jam

2012-10-15 Thread Martin Drasar
On 15.10.2012 13:52, Manu wrote: We did a 48hr game jam at work this past weekend. We decided to do our entry in D, to further prove that D was a viable and productive solution for real-world game dev. Here's our entry, for those interested. It has only been built/tested in Windows using

Re: Latest Version of Ali's Book

2012-10-11 Thread Martin Drasar
On 11.10.2012 18:17, Paul wrote: Anyone know where I can find the latest version of Ali Çehreli's D book? Thanks. Hi Paul, I thinks that the latest version is always on Ali's webpage... http://ddili.org/ders/d.en/index.html Martin

Re: Passing associative array to another thread

2012-09-22 Thread Martin Drasar
On 21.9.2012 19:01, Jacob Carlborg wrote: Perhaps declaring the associative array as shared. An alternative would be to serialize the aa, pass it to another thread, and deserialize it. That would though create a copy. Hi Jacob, thanks for the hint. Making it shared sounds a bit fishy to me.

Re: Passing associative array to another thread

2012-09-22 Thread Martin Drasar
On 22.9.2012 13:19, Jonathan M Davis wrote: The problem with immutable is probably due to this bug: http://d.puremagic.com/issues/show_bug.cgi?id=5538 And casting to shared probably won't work due to this bug: http://d.puremagic.com/issues/show_bug.cgi?id=6585 std.variant needs quite

Re: Passing associative array to another thread

2012-09-22 Thread Martin Drasar
On 22.9.2012 13:50, Johannes Pfau wrote: 1. Declare it as shared There's also __gshared. Yup, that works. Thanks

Passing associative array to another thread

2012-09-21 Thread Martin Drasar
Hi, I am using the std.concurrency module and I would like to send an associative array to another thread. If I try this: string[string] aa; someThread.send(aa); I get: Aliases to mutable thread-local data not allowed. And if I try to use this: immutable(string[string]) aa;

Task management

2012-09-14 Thread Martin Drasar
Hi, can anyone tell me what is the good (for arbitrary low values of good) way to forcibly end a running task? I am using a task pool from std.parallelism to execute delegates supplied by various plugins. As I have no real control over what gets executed and how, there is always a possibility

Re: variadic mixin templates and other stuff

2012-04-21 Thread Martin Drasar
On 20.4.2012 19:00, John Chapman wrote: On Friday, 20 April 2012 at 14:57:03 UTC, Martin Drasar wrote: On 20.4.2012 16:09, Timon Gehr wrote: I tried but it still refuses to compile: string interfaceGuid(string ifaceName) { return ifaceName ~ Guid; } mixin template EXPOSE_INTERFACES(T

variadic mixin templates and other stuff

2012-04-20 Thread Martin Drasar
Hi, I am migrating a C++ project to D and I have hit a roadblock that I hope you might help me with. My code is heavily inspired by the COM architecture, so I have naturally take a look at std/c/windows/com.d, just to find out that it does not contain all I need. In the C++ code I have several

Re: variadic mixin templates and other stuff

2012-04-20 Thread Martin Drasar
On 20.4.2012 16:09, Timon Gehr wrote: Thanks Timon for the answer. My questions are following: - can mixin templates be used this way? They can only mixin declarations. - why are they complaining? Because if is a statement and not a declaration. Ok. - is there a better way to do

Re: Mascot for D

2012-04-06 Thread Martin Drasar
On 6.4.2012 13:05, Alix Pexton wrote: My first thought when I saw this thread was some kind of cute little Astronaut. I like the name Digital Martian but worry that any kind of alien mascot would lack originality or require explanation. What does it take to be a Martian? DO the Mars Rovers

Function definition in multiple modules

2012-03-29 Thread Martin Drasar
Hi, I have a class that implements a lot of interfaces and I would like to separate the definition into different files, i.e. implementation of one interface in one file. Something akin to this C++ code: a.cpp: class A { void b(); void c(); }; b.cpp: void A::b() {} c.cpp: void A::c() {}

Re: Function definition in multiple modules

2012-03-29 Thread Martin Drasar
On 29.3.2012 12:02, simendsjo wrote: Your looking for partial classes? D doesn't have this as far as I know. alias this should work for more than one value in the future, and then (I think) you should be able to do something like this: class XIB : IB {} class XIA : IA {} class X : IA, IB

Re: Function definition in multiple modules

2012-03-29 Thread Martin Drasar
On 29.3.2012 13:05, simendsjo wrote: It's not string mixins: mixin template XIA() { void a() { ... } // regular function } class X : IA { mixin XIA!() } XIA is injected into X, so X now looks like class X : IA { void a() { ... } } I should have thought and experiment more

Re: Happy New Year in 2012....

2012-01-03 Thread Martin Drasar
On 3.1.2012 14:43, Piotr Szturmaj wrote: Trass3r wrote: Don't forget Germany ;) You forgot Poland ;) And Czech republic... The Force in Europe is strong :-)

Names of C functions exported from a dll

2012-01-02 Thread Martin Drasar
Hi everybody, I wanted to ask if there is any specific reason why the name of the first C function exported from a dll starts with underscore and any subsequesnt name does not. Regards, Martin Disclaimer: I have already posted this as a subquestion in one D-Learn thread, but it did not get

Re: Allocating memory in D shared library when accessed from C++

2011-12-20 Thread Martin Drasar
Dne 20.12.2011 2:22, Andrej Mitrovic napsal(a): test.cpp: http://www.ideone.com/uh7vN DLibrary.d: http://www.ideone.com/fOLN8 $ g++ test.cpp $ dmd -ofDLibrary.dll DLibrary.d $ a.exe $ 9 Hi, Andrej, you are right, this works. Problem is going to be either in VisualD or cv2pdb. For those

Allocating memory in D shared library when accessed from C++

2011-12-19 Thread Martin Drasar
Hello everyone, I would like to ask you about linking D shared objects (.dll and .so) from a C++ program. Say I have this C++ loader: typedef int (*MagicFunction) (); HMODULE handle = LoadLibraryA(DLibrary.dll); if (handle) { MagicFunction fn = (MagicFunction) GetProcAddress(handle,