Can I start a process 'std.process.spawnProcess' with a different process group id other than the parent id?

2022-11-17 Thread Mina via Digitalmars-d-learn
Doing my research, the only option I see is by using 'setpgid' from 'core.sys.posix.unistd' and setting the foreground process using 'tcsetpgrp' from the same module, but I don't know how to go about doing that with the 'std.process.spawnProcess', I'm writing a shell and the purpose of this is

Re: Is there an easy way to mimic generics with an accept method of a visitor pattern?

2021-02-18 Thread Mina via Digitalmars-d-learn
On Thursday, 18 February 2021 at 13:53:19 UTC, Paul Backus wrote: Another possibility is to use discriminated unions and tag-based dispatch (i.e., switch statements) instead of classes and virtual method dispatch. This would make it a bit harder to follow the book, but might be a better learnin

Is there an easy way to mimic generics with an accept method of a visitor pattern?

2021-02-18 Thread Mina via Digitalmars-d-learn
I'm following along with the crafting interpreters book (https://craftinginterpreters.com) and it goes into implementing a visitor pattern that returns generic types, so implementing it in D came down to the accept method causing undefined symbol error that goes away when changing it to returni

Re: Cannot compile program with DMD built from source

2016-03-09 Thread Minas Mina via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 16:13:38 UTC, Minas Mina wrote: Hello, I have followed the instructions here (http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to install DMD, druntime and phobos from source. My platform is Ubuntu 15.10 x64. This is the error I get: http://pastebin.com/kWC

Cannot compile program with DMD built from source

2016-03-09 Thread Minas Mina via Digitalmars-d-learn
Hello, I have followed the instructions here (http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to install DMD, druntime and phobos from source. My platform is Ubuntu 15.10 x64. This is the error I get: http://pastebin.com/kWCv0ymn

Re: Application with WinMain does not start

2016-03-05 Thread Minas Mina via Digitalmars-d-learn
On Saturday, 5 March 2016 at 14:08:28 UTC, Mike Parker wrote: On Saturday, 5 March 2016 at 14:01:11 UTC, Mike Parker wrote: If you use WinMain, you do not need that flag. Actually, I need to amend that. It isn't needed with WinMain when using the Microsoft linker, but it is when using OPTLIN

Application with WinMain does not start

2016-03-05 Thread Minas Mina via Digitalmars-d-learn
I added a WinMain function to my application because I don't want it to open a console when running on windows. But now it doesn't even start... extern (Windows) int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { bool b = true; while

Re: efficient and safe way to iterate on associative array?

2016-03-04 Thread Minas Mina via Digitalmars-d-learn
On Friday, 4 March 2016 at 13:53:22 UTC, aki wrote: Is it okay to modify associative array while iterating it? import std.stdio; void main() { string[string] hash = [ "k1":"v1", "k2":"v2" ]; auto r = hash.byKeyValue(); while(!r.empty) { auto key = r.front

Trouble installing DCD on Windows

2016-02-27 Thread Minas Mina via Digitalmars-d-learn
Hello. I'm trying to install DCD on windows 8.1 using DUB but I get an error. When executing "dub build --build=release --config=client" I get the following error: => Root package dcd contains reference to invalid package libdparse >=0.5.0 <0.6.0 <=

Re: std.experimental.logger.Logger writeLogMsg is @safe?

2016-02-22 Thread Minas Mina via Digitalmars-d-learn
On Monday, 22 February 2016 at 23:03:38 UTC, Jonathan M Davis wrote: On Monday, February 22, 2016 22:22:01 Minas Mina via Digitalmars-d-learn wrote: [...] Short answer: [...] Great, thanks.

std.experimental.logger.Logger writeLogMsg is @safe?

2016-02-22 Thread Minas Mina via Digitalmars-d-learn
I'm trying to inherit from Logger, and I my custom logger to print to stdout using writeln(). But I can't because writeLogMsg is @safe, whereas writeln() is @system. Why is writeLogMsg @safe? This is too restrictive.

Re: is increment on shared ulong atomic operation?

2016-02-07 Thread Minas Mina via Digitalmars-d-learn
On Sunday, 7 February 2016 at 19:43:23 UTC, rsw0x wrote: On Sunday, 7 February 2016 at 19:39:27 UTC, rsw0x wrote: On Sunday, 7 February 2016 at 19:27:19 UTC, Charles Hixson wrote: If I define a shared ulong variable, is increment an atomic operation? E.g. shared ulong t; ... t++; It seems

Re: Proper Use of Assert and Enforce

2016-02-05 Thread Minas Mina via Digitalmars-d-learn
On Wednesday, 14 March 2012 at 05:44:24 UTC, Chris Pons wrote: I'm new, and trying to incorporate assert and enforce into my program properly. My question revolves around, the fact that assert is only evaluated when using the debug switch. I read that assert throws a more serious exception th

Re: Most performant way of converting int to string

2015-12-23 Thread Minas Mina via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 22:29:31 UTC, Andrew Chapman wrote: On Wednesday, 23 December 2015 at 11:46:37 UTC, Jakob Ovrum wrote: On Wednesday, 23 December 2015 at 11:21:32 UTC, Jakob Ovrum wrote: Dynamic memory allocation is expensive. If the string is short-lived, allocate it on the st

Re: Using executeShell in multiple thread causes access violation error

2015-07-17 Thread Minas Mina via Digitalmars-d-learn
bump

Using executeShell in multiple thread causes access violation error

2015-07-13 Thread Minas Mina via Digitalmars-d-learn
I have written a script that visits all directories in the current directory and executes a command. In my case, "git pull". When running the script serially, everything is fine. All git repositories are pulled. But I'd like to pull multiple repositories in parallel to speed things up. So I

Re: How do I use dub?

2014-10-24 Thread Minas Mina via Digitalmars-d-learn
Oh and another thing: The program compiles right now but I can't execute it because for some reason: Failed to create a child process. Cannot run program "/home/minas/Projects/eclipse_workspace/DTest/dtest" (in directory "/home/minas/Projects/eclipse_workspace/DTest"): error=13, Permission den

How do I use dub?

2014-10-24 Thread Minas Mina via Digitalmars-d-learn
I intent to use D to make a small 2D game. I have downloaded eclipse, DDT plugin and dub. I also set the path to dub in eclipse. So I made a new project, tested a writeln and it worked. The next step was to add some dependencies for derelict. I need SFML for now (and DerelictUtils of course).

Re: Global const variables

2014-10-21 Thread Minas Mina via Digitalmars-d-learn
On Tuesday, 21 October 2014 at 08:02:52 UTC, bearophile wrote: Currently this code gets rejected: const int[] a = [1]; void main() pure { auto y = a[0]; } test2.d(3,14): Error: pure function 'D main' cannot access mutable static data 'a' test2.d(3,14): Error: pure function 'D main' cannot