Re: when I run dub within git bash, dub prompts are not displayed. For instance...

2017-06-10 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 10 June 2017 at 16:11:31 UTC, WhatMeWorry wrote: kheaser@IT-ASST-SB MINGW64 /c/Users/kheaser/Git/Delivery/projects (master) $ dub init 00_01_print_ogl_ver ... All this white space here is me just pressing the Enter key ... to get the default values. If the problem is that the t

Re: Zero-cost version-dependent function call at -O0.

2017-06-25 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 25 June 2017 at 15:58:48 UTC, Johan Engelen wrote: How would you solve this problem: do an optional function call depending on some version(X). If version(X) is not defined, there should be no call and no extra code at -O0. ``` { ... foo(); // either compiles to a function call,

Re: opEquals nothrow

2017-07-20 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 20 July 2017 at 15:10:24 UTC, Aldo wrote: extern(C) nothrow { void onMouseClick(GLFWwindow* window, int button, int action, int d) { try { // my code } catch { } } } Tangent but an easy way of nothrowing: extern(C

Re: It makes me sick!

2017-07-28 Thread Anonymouse via Digitalmars-d-learn
On Friday, 28 July 2017 at 05:14:16 UTC, FoxyBrown wrote: If dmd breaks in strange and unpredictable ways IT IS DMD's fault! No exceptions, no matter what you believe, what you say, what lawyer you pay to create a law for you to make you think you are legally correct! You can make any claim you

Re: It makes me sick!

2017-07-28 Thread Anonymouse via Digitalmars-d-learn
On Friday, 28 July 2017 at 21:23:22 UTC, FoxyBrown wrote: So, the program, if it is updated shouldn't use the mp3's then. Why the hell is the program that you say was upgraded to use the ogg still searching and using mp3's? You are trying to make up reasons why it shouldn't work... at least com

Re: Compile Time versus Run Time

2017-07-31 Thread Anonymouse via Digitalmars-d-learn
On Monday, 31 July 2017 at 15:46:47 UTC, inevzxui wrote: On Monday, 31 July 2017 at 15:43:21 UTC, Martin Tschierschke wrote: As a rookie in D programming I try to understand the power of templated functions with compile time parameters. With DMD 2.074 a compile time format (auto output = forma

Re: Efficiently streaming data to associative array

2017-08-08 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 16:00:17 UTC, Steven Schveighoffer wrote: I wouldn't use formattedRead, as I think this is going to allocate temporaries for a and b. What would you suggest to use in its stead? My use-case is similar to the OP's in that I have a string of tokens that I want split

Re: Estimating free system resource at runtime

2017-08-20 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 20 August 2017 at 15:49:09 UTC, seany wrote: However, i cant find anything on google to tell me how to estimate system resource using D. for C++ and windowes, i could find some API-s Can e do this in D? You can just use those C APIs. I believe the GC does, unless I'm reading it w

Re: Remove all blank lines from a file

2017-08-31 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 31 August 2017 at 14:44:07 UTC, vino wrote: Hi All, Can some provide me a example of how to remove all blank lines from a file. From, Vino.B Super verbose, but: import std.stdio; import std.file; import std.algorithm.iteration; enum inFilename = "in.txt"; enum outFilename =

How do I use Socket.select?

2017-11-12 Thread Anonymouse via Digitalmars-d-learn
I've been using blocking Sockets with timeouts for a while now, but wherever I look the word is "do consider using a non-blocking socket". Even the docs for std.socket.setOption; In a typical application, you might also want to consider using a non-blocking socket instead of setting a timeout

dmd/ldc failed with exit code -11

2017-11-20 Thread Anonymouse via Digitalmars-d-learn
I have a large named enum (currently 645 members) of IRC event types. It's big by neccessity[1]. I'm using dub, and both dmd and ldc successfully build it in test and debug modes, but choke and die on plain and release. I bisected it down to when I did a big addition to the enum to encompass

Re: dmd/ldc failed with exit code -11

2017-11-21 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 00:36:00 UTC, rikki cattermole wrote: Source code please. https://github.com/zorael/kameloso.git I'm not proud of some of the early bits there (main.d) so don't judge me, please. I'm learning as I go. The offending bits are IRCEvent.Type in ircstructs.d[1]. I

Re: dmd/ldc failed with exit code -11

2017-11-21 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 10:12:11 UTC, Petar Kirov [ZombineDev] wrote: On Tuesday, 21 November 2017 at 10:10:59 UTC, Petar Kirov [ZombineDev] wrote: On Tuesday, 21 November 2017 at 00:15:04 UTC, Anonymouse wrote: I have a large named enum (currently 645 members) of IRC event types. It's

Re: dmd/ldc failed with exit code -11

2017-11-21 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 13:28:44 UTC, Anonymouse wrote: Looking at the dmd command dub issues and testing them myself I notice that if I reorder the arguments it builds. $ dmd -d -oftest source/arsd/*.d source/kameloso/plugins/*.d source/kameloso/*.d zsh: segmentation fault (core dumpe

Re: dmd/ldc failed with exit code -11

2017-11-22 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 19:22:47 UTC, Anonymouse wrote: Compiling a debug dmd and running the build command in gdb, it seems to be a stack overflow at ddmd/dtemplate.d:6241, TemplateInstance::needsCodegen(). After a lot of trial and error I managed to find /a/ line which lets it compi

Re: Does D have class' attributes like C#'s?

2017-12-16 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 16 December 2017 at 19:57:30 UTC, Marc wrote: C# has a quite nice way to store metadata about a property by a feature called atributes[1]. For example, I can write something like this: class A { [TextSize(256)] string Name { get; set; } } So using runtime/reflection I can

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-16 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 16 December 2017 at 21:56:49 UTC, Jonathan M Davis wrote: The only way to catch an exception is with a catch block, and if you do If you return inside a scopeguard though, the exception (or error!) is swallowed. https://run.dlang.io/is/GEtQ6D void main() { foo(); writeln

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-17 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 17 December 2017 at 08:10:06 UTC, codephantom wrote: On Sunday, 17 December 2017 at 00:10:27 UTC, Anonymouse wrote: If you return inside a scopeguard though, the exception (or error!) is swallowed. https://run.dlang.io/is/GEtQ6D The scope guard will not 'swallow' it, if you use -rel

Version Cygwin

2017-12-21 Thread Anonymouse via Digitalmars-d-learn
Cygwin is a reserved version[1], alongside Windows and linux and the like. However it doesn't seem to be automatically recognised. import std.stdio; void main() { version(Cygwin) writeln("Cygwin"); } Compiled from a Cygwin prompt this prints nothing. So I thought to add versions: [ "Cyg

Re: It's possible to declare a variable inside a static foreach()?

2017-12-21 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 21 December 2017 at 16:25:00 UTC, Marc wrote: For example, I'd like to declare a variable inside a static foreach like in below code, just for better organization, otherwise, I have to use the value directly instead of the variable. If the value is used more than once, it might be

Re: Version Cygwin

2017-12-22 Thread Anonymouse via Digitalmars-d-learn
On Friday, 22 December 2017 at 03:24:15 UTC, rikki cattermole wrote: You are not using a Cygwin build. It doesn't matter who calls a process, it doesn't change the version's by itself. As far as I know, nobody supports Cygwin like this. I see, thank you.

Error: out of memory

2018-01-10 Thread Anonymouse via Digitalmars-d-learn
I've been building and testing my project on linux, juggling the ~5GB+ RAM needed to actually compile, but it's been working. I want to test it on a Windows 10 PC now but compilation with dmd (2.078.1) fails, both with --arch x86 and x86_64. LDC works, but it easily takes twice the time to bui

Re: Error: out of memory

2018-01-10 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 10 January 2018 at 19:15:00 UTC, Anonymouse wrote: I've been building and testing my project on linux, juggling the ~5GB+ RAM needed to actually compile, but it's been working. I want to test it on a Windows 10 PC now but compilation with dmd (2.078.1) That's naturally supposed

invalid or corrupt file: duplicate COMDAT / Previous Definition Different

2018-01-10 Thread Anonymouse via Digitalmars-d-learn
I haven't been testing my project on Windows for a while, and on top of having issues with out of memory errors when unittesting I see I can't build it normally either. dmd is 2.078.0. $ dub build -c cygwin -a x86_64 Performing "debug" build using dmd for x86_64. kameloso 1.0.0-beta.2+commit.57

Re: Error: out of memory

2018-01-10 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 10 January 2018 at 19:21:21 UTC, Adam D. Ruppe wrote: On Wednesday, 10 January 2018 at 19:15:00 UTC, Anonymouse wrote: I want to test it on a Windows 10 PC now but compilation with dmd (2.078.1) fails, both with --arch x86 and x86_64. LDC works, but it easily takes twice the time

Re: invalid or corrupt file: duplicate COMDAT / Previous Definition Different

2018-01-10 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 10 January 2018 at 20:19:50 UTC, Benjamin Thaut wrote: Am 10.01.2018 um 20:32 schrieb Anonymouse: I don't have a reduced testcase yet. I figured I'd ask if it's something known before making the effort. Are you by any chance mixing debug and release builds? Or are the -version

Re: invalid or corrupt file: duplicate COMDAT / Previous Definition Different

2018-01-12 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 10 January 2018 at 20:53:24 UTC, Anonymouse wrote: None of the (version specifiers in the) build configurations I have touch upon the part of the fairly innocent code mentioned in the error message, if I'm reading it right. (https://github.com/zorael/kameloso/blob/c00ca4489e39348b

Re: getSymbolsByUDA does not take private symbols under consideration. Should I file a bug?

2018-02-16 Thread Anonymouse via Digitalmars-d-learn
On Friday, 16 February 2018 at 09:26:47 UTC, Piotr Mitana wrote: Hello, The code below: import std.traits; enum Attr; class MyClass { private @Attr int a; static assert(getSymbolsByUDA!(typeof(this), MyClass).length == 1); } does not compile as sta

Re: Is there something special required to use Appender.clear

2018-03-27 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 27 March 2018 at 12:17:58 UTC, Ellie Harper wrote: Sorry if this is a stupid question, but is there something special required to call Appender.clear? When I attempt even just a simple use I am getting compile errors relating to `template object.clear`. When I try: import st

utf.d codeLength asserts false on certain input

2018-03-27 Thread Anonymouse via Digitalmars-d-learn
My IRC bot is suddenly seeing crashes. It reads characters from a Socket into an ubyte[] array, then idups parts of that (full lines) into strings for parsing. Parsing involves slicing such strings into meaningful segments; sender, event type, target channel/user, message content, etc. I can as

dustmite watch shell script (.test vs .lookahead.*)

2018-04-06 Thread Anonymouse via Digitalmars-d-learn
The dustmite wiki[0] lists the following example script for use to monitor the reduction progress: #!/bin/sh watch -cn 0.1 "zsh -c 'ls -al $1.reduced/**/*.d ; colordiff -ru $1.reduced $1.test'" This repeatedly compares the $1.reduced directory with a $1.test directory. The dustmite run howe

Re: dustmite watch shell script (.test vs .lookahead.*)

2018-04-07 Thread Anonymouse via Digitalmars-d-learn
On Friday, 6 April 2018 at 15:42:04 UTC, Vladimir Panteleev wrote: On Friday, 6 April 2018 at 15:35:59 UTC, Anonymouse wrote: The dustmite wiki[0] lists the following example script for use to monitor the reduction progress: Here's a more complete version that also works with -j: https://gist

Re: Ascii string literal.

2016-05-06 Thread Anonymouse via Digitalmars-d-learn
On Friday, 6 May 2016 at 20:29:35 UTC, Adam D. Ruppe wrote: On Friday, 6 May 2016 at 20:01:27 UTC, Alexandru Ermicioi wrote: Is it possible somehow to convert implicitly a string literal Not implicitly (well, unless you just use string, ascii is a strict subset of utf-8 anyway), but you could

Re: Confusion with anonymous functions and method overloads

2016-05-21 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 21 May 2016 at 14:39:59 UTC, pineapple wrote: void clean(in void delegate(in T value) func){ this.clean((in T values[]) => { foreach(value; values) func(value); }); This doesn't do what you think it does. It passes a lambda that *returns* that forea

Re: binary expression...

2016-05-21 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 21 May 2016 at 18:10:55 UTC, captain_fid wrote: Please forgive if asked before. My google skills seemed to fail me and didn't see any result from search. My problem is simple (though not my understanding LOL). struct D { int value; bool opEquals()(bool value) const { r

Re: Emulate C's (polymorphic) NULL type

2016-06-06 Thread Anonymouse via Digitalmars-d-learn
On Monday, 6 June 2016 at 09:43:23 UTC, ParticlePeter wrote: A extern( C ) function should be able to take it as either one. Missed this bit. Not sure about that one.

Re: Emulate C's (polymorphic) NULL type

2016-06-06 Thread Anonymouse via Digitalmars-d-learn
On Monday, 6 June 2016 at 09:43:23 UTC, ParticlePeter wrote: In C NULL can be used as integer as well as null pointer. Is there a way to create such a type in D? The type should have only one value which is obviously (0/null). A extern( C ) function should be able to take it as either one. Over

Re: Emulate C's (polymorphic) NULL type

2016-06-06 Thread Anonymouse via Digitalmars-d-learn
On Monday, 6 June 2016 at 12:09:33 UTC, ParticlePeter wrote: I don't see the connection here, you introduced two symbols with two different types. I want one symbol which can pose as two different (constant) types. Ah, my apologies, I misunderstood the question.

Re: how to mark an extern function @nogc?

2016-07-11 Thread Anonymouse via Digitalmars-d-learn
On Monday, 11 July 2016 at 15:54:02 UTC, Seb wrote: On Monday, 11 July 2016 at 01:59:51 UTC, Adam Sansier wrote: On Monday, 11 July 2016 at 01:58:23 UTC, Adam Sansier wrote: I'm using some win functions that don't use the gc and are not marked, specifically CLSIDFromString that I imported myse

Re: aspects on methods?

2016-07-13 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 11:26:20 UTC, jj75607 wrote: I want to use aspect-like annotations to transform [...] Two methods spring to mind but both create new types. You can either write a function that iterates through the members of your class, generating a string mixin that selectively h

Re: alias to function literal, call without () not possible

2016-08-03 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 3 August 2016 at 17:16:10 UTC, Andre Pany wrote: Hi, I just stumbled over this behavior. I am not sure whether the behavior is correct or not. [...] alias foo = () => new Object; ...is an alias for a delegate/function returning an Object. It is analogous to alias foo = () { re

Re: Static CT Factory

2016-08-18 Thread Anonymouse via Digitalmars-d-learn
On Friday, 19 August 2016 at 01:10:42 UTC, Engine Machine wrote: I have a template that is suppose to create a type based on a template parameter static if (T == "int") { auto x = New!int(); } else static if (T == "double") { auto x = New!double(); } x = 1.234; This is just an example,

Re: Getting a String Literal From an Aliased Template Mixin Parameter

2016-09-14 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 15 September 2016 at 00:15:42 UTC, jsako wrote: I was making a quick mocking infrastructure for internal mocks so I wouldn't have to pass in objects to constructors all the time and came up with this: [...] This works great as long as there is only one mock object. I thought abo

Re: What exactly does the compiler switch -betterC do?

2016-09-20 Thread Anonymouse via Digitalmars-d-learn
On Monday, 20 June 2016 at 06:35:32 UTC, Jacob Carlborg wrote: On 2016-06-19 21:53, Gary Willoughby wrote: When compiling, what exactly does the -betterC flag do? The command help says "omit generating some runtime information and helper functions" but what does this really mean? Is there any

Re: Dustmite can't handle my memory segfault

2016-10-22 Thread Anonymouse via Digitalmars-d-learn
On Friday, 21 October 2016 at 10:13:23 UTC, Nordlöw wrote: #!/usr/bin/env python3 import sys import pty stat = pty.spawn(sys.argv[1:]) if stat == 256: exit(42)# remap to 42 else: exit(stat) Assuming you want to remap 134 to 0 (success): #!/bin/bash cmd="$1" shif

Re: Correct way to create singleton?

2016-11-10 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 10 November 2016 at 17:17:51 UTC, Konstantin Kutsevalov wrote: Hi, what is a correct (and simple) way to create an singleton? https://wiki.dlang.org/Low-Lock_Singleton_Pattern

Re: Impressed with Appender - Is there design/implementation description?

2016-12-06 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 10:52:44 UTC, thedeemon wrote: It's rather simple, just take a look at its source code in std.array. It's an ordinary linear array partially filled with your data. [...] 2. Up until 4 KB it reallocates when growing, but after 4 KB the array lives in a larger po

Re: Separate IP parts

2016-12-09 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 10 December 2016 at 03:51:34 UTC, brocolis wrote: How do I separate IP parts with dlang? I found this very cool trick, with C++: http://stackoverflow.com/a/5328190 std::string ip ="192.168.1.54"; std::stringstream s(ip); int a,b,c,d; //to store the 4 ints char ch; //to temporaril

Standard output does not get flushed in cygwin?

2017-01-01 Thread Anonymouse via Digitalmars-d-learn
Try this in a cygwin terminal: import std.stdio; import core.thread; void main() { foreach (i; 0..10) { writeln(i); Thread.sleep(1.seconds); } } This program will not output i, wait a second and then output i+1, etc. It will be silent for ten seconds and then spam t

Re: Standard output does not get flushed in cygwin?

2017-01-02 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 1 January 2017 at 13:04:30 UTC, rikki cattermole wrote: What is your terminal emulator? Poderosa has a known problem for this. Where as ConEmu (which I have since moved over to) works fine. Fun fact, I had a similar file to the yours in /tmp/test.d :) The default mintty. I tried Co

Re: String characters not extended

2017-01-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 2 January 2017 at 21:07:37 UTC, Ignacious wrote: [...] Assuming Windows: version(Windows) shared static this() { import core.sys.windows.windows; SetConsoleCP(65001); SetConsoleOutputCP(65001); }

Re: String characters not extended

2017-01-04 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 3 January 2017 at 19:40:20 UTC, Daniel Kozák wrote: Why do not use CP_UTF8 constant instead of 65001? It is safer, easier to read and understand I have no reason to back it up with. I'm literally just copy/pasting what others have suggested I use.

Re: alias and UFCS

2017-01-24 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote: This code: T tFunc(alias F, T)(T n) { n.F; return n; } Produces this error: Error: no property 'F' for type 'int[]' (or whatever type I use). I believe UFCS is supposed to only work with top-level functions. I don't r

Re: is char[] faster than string?

2017-04-07 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 5 April 2017 at 22:05:07 UTC, H. S. Teoh wrote: If you are doing lots of concatenation and produce a single big string at the end, take a look at std.array.appender. Though if you're concerned about performance, you really should run a profiler. Last I heard, appender may not be

Deprecation: foo.bar is not visible from module traits

2017-05-07 Thread Anonymouse via Digitalmars-d-learn
I'm reworking my code to use UDAs, and I'm running into a wall of text of deprecation warnings when compiling. import std.traits; private: struct SomeUDA {} @SomeUDA void foo() {} @SomeUDA void bar() {} @SomeUDA void etc() {} public: void main() { mixin("static import thisModule = "

Re: No tempFile() in std.file

2017-05-16 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 05:09:12 UTC, Era Scarecrow wrote: On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote: Personally, I think that it would be very much worth making hello world larger, since hello world really doesn't matter, but because there are plenty of folks checking o

Searching strings with indexOf vs countUntil

2017-05-25 Thread Anonymouse via Digitalmars-d-learn
I was profiling my program with callgrind and saw that a lot of time was spent in countUntil (std.algorithm.searching) on strings. I had chosen to use it instead of indexOf (std.string), with the plain assumption that countUntil wouldn't decode, while indexOf would. Comparing microbenchmarks

Re: Searching strings with indexOf vs countUntil

2017-05-25 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 25 May 2017 at 11:55:21 UTC, Kagamin wrote: I would guess indexOf returns a value suitable for indexing, therefore it counts code units, while countUntil counts range elements - code points in case of a string. Also number of code points is not suitable for indexing an utf8 string,

Avast virus warning?

2017-06-05 Thread Anonymouse via Digitalmars-d-learn
I just sent a pre-compiled .exe of my project to a friend, and his Avast anti-virus promptly quarantined it and sent it off for analysis. I tried sending him a Hello World[1] with the same results. Is this something common for d programs? Anything I can do to work around it from my end? [1]

Re: Avast virus warning?

2017-06-05 Thread Anonymouse via Digitalmars-d-learn
On Monday, 5 June 2017 at 16:40:25 UTC, rikki cattermole wrote: It would be nice to get in touch with their engineers to find out what is really going on. Tried an email and hit a paywall. :c "We’re sorry, but we can’t seem to find a record of your license in our system."

digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
I'm trying to bisect a dmd compilation error on Windows 10 and I can't get digger to do more than one initial test. When preparing to compile the next dmd build (the BAD revision) it errors out. This is in a normal cmd console. The bisect ini has nothing weird in it: ``` bad = v2.088.1 good =

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 20:09:43 UTC, MoonlightSentinel wrote: On Monday, 3 February 2020 at 16:54:20 UTC, Anonymouse wrote: It does a `dmd.exe -of..\generated\build.exe`, but then the immediately following call to `..\generated\build.exe` fails? What am I doing wrong? The executable wa

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 20:54:46 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 20:41:00 UTC, Anonymouse wrote: It doesn't seem to include debugging symbols. Is your Digger version up-to-date? https://github.com/CyberShadow/ae/commit/48ee31a3b0d47e52769ee87b0e673034abe4add

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:33:09 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 21:30:57 UTC, Anonymouse wrote: I was on beta 8. I forced dub to download the latest now (3.0.0-alpha-9), wiped the work directory and retried, but to similar results. The latest is v3.0.0-alph

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:58:31 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 21:44:20 UTC, Anonymouse wrote: New log: https://pastebin.com/raw/uUMNQjEN It looks like it fails to execute git (to get the current version for the build). I don't know why that fails, as I

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 22:08:50 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 22:01:18 UTC, Anonymouse wrote: No, C:\Temp\work\dl\git does not exist. :o OK, that makes sense. Please try the latest Digger version (24cd4168956dad382d05984b4b8d37d9e8ebe3ae). Works great.

Re: Some impressions/notes from a new D programmer

2020-02-12 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 12 February 2020 at 13:36:13 UTC, mark wrote: Some cargo packages are applications. If I do 'cargo install someapp' it will be installed in $HOME/.cargo/bin. So by simply adding that to my PATH, I can easily use all installed rust apps. But dub doesn't appear to have an equivalent

Re: Overfflow in Assert error messages

2020-02-13 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 13 February 2020 at 07:49:13 UTC, Adnan wrote: However my test fails saying something like: source/binary_search.d(33): [unittest] 18446744073709551615 != 1 core.exception.AssertError@source/binary_search.d(33): 18446744073709551615 != 1 What's causing this underflow? It's ulong

Re: How to get to body of HTTP 500 error with std.net.curl.get()?

2020-02-15 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 15 February 2020 at 16:25:42 UTC, Gregor Mückl wrote: Unfortunately, this is not true. The msg only contains the text information in the status line of the HTTP reply. If I'm not mistaken, the exception is created in this line in std/net/curl.d: enforce(statusLine.code / 100

Re: How to get to body of HTTP 500 error with std.net.curl.get()?

2020-02-16 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 16 February 2020 at 09:13:54 UTC, ikod wrote: Just a note - this is not a bug, server really send empty body: < HTTP/1.1 500 Internal Server Error < cache-control: private < server: Microsoft-IIS/10.0 < x-aspnetmvc-version: 5.1 < access-control-allow-origin: * < x-aspnet-version: 4.0.

dub and -lowmem: does nothing

2020-03-20 Thread Anonymouse via Digitalmars-d-learn
Manjaro/Arch x86_64, dmd v2.091.0, dub 1.19.0. I have a project which dmd on Windows fails to compile, throwing an OutOfMemoryError[1]. Up until recently it could be worked around by using `--build-mode=singleFile`, but now that's no longer enough and errors out too (on AppVeyor). The obviou

Re: dub and -lowmem: does nothing

2020-03-21 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 21 March 2020 at 00:17:37 UTC, kinke wrote: Most likely because dub doesn't actually invoke the listed command, but uses a response file to work around cmdline length limits. -lowmem in response files is ignored by DMD (needs to be parsed and set before druntime initialization, but

Re: How to create an array with custom length?

2020-03-27 Thread Anonymouse via Digitalmars-d-learn
On Friday, 27 March 2020 at 19:30:39 UTC, Quantium wrote: Code int n=0; readf(" %d", &n); int[n] m; generated an error (DMD compiler): Cannot read n at compile time. How to create an array with custom length? The tour has a page for this: https://tour.dlang.org/tour/en/basics/array

dub sourceFiles

2020-03-31 Thread Anonymouse via Digitalmars-d-learn
I have a library package that I split up into subpackages, but I'm having to do mental gymnastics to make it only compile the files I want. The problem is that even if you specify some `sourceFiles`, it will build everything under the sun inside `sourcePaths`, which defaults to "source" or "s

@safe function with __gshared as default parameter value

2020-04-08 Thread Anonymouse via Digitalmars-d-learn
``` import std.stdio; @safe: __gshared int gshared = 42; void foo(int i = gshared) { writeln(i); } void main() { foo(); } ``` This currently works; `foo` is `@safe` and prints the value of `gshared`. Changing the call in main to `foo(gshared)` errors. Should it work, and can I expe

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 19:22:11 UTC, jmh530 wrote: On Wednesday, 8 April 2020 at 18:50:16 UTC, data pulverizer wrote: On Wednesday, 8 April 2020 at 16:53:05 UTC, Anonymouse wrote: ``` import std.stdio; @safe: __gshared int gshared = 42; void foo(int i = gshared) { writeln(i); } v

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 19:53:03 UTC, jmh530 wrote: Well that definitely shouldn't happen. I would file a bug report. Filed as https://issues.dlang.org/show_bug.cgi?id=20726

docs.json is incomplete

2020-04-10 Thread Anonymouse via Digitalmars-d-learn
I'm trying to get docs for my project hosted, and everything works, except there are entries missing. Looking at the generated docs.json there's simply a lot of omitted stuff. Example: http://kameloso.dpldocs.info/kameloso.plugins.sedreplace.html http://kameloso.dpldocs.info/source/kameloso.pl

Re: docs.json is incomplete

2020-04-11 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 11 April 2020 at 13:13:45 UTC, Adam D. Ruppe wrote: On Saturday, 11 April 2020 at 06:49:21 UTC, Anonymouse wrote: (TL;DR: the module contains one public class and (private) two structs, three free functions and one module-level mixin, but only the class is shown. It is all under

Re: Bug in std.json or my problem

2020-04-22 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 22 April 2020 at 17:48:18 UTC, Craig Dillabaugh wrote: The crash is caused because the 'income' field with value 0.0 is output as 0 (rather than 0.0) and when it is read this is interpreted as an integer. Shouldn't this work? Yes, it's just buggy. Giving it a value of an even

Re: Can't get dub dustmite to work

2020-04-25 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 25 April 2020 at 09:38:59 UTC, aliak wrote: Then I run this dub dustmite command: dub dustmite -b unittest ../dubdust --compiler-regex="never matches" I have had zero luck with dustmite via dub. I would honestly recommend that you create a shell script that does `dub test 2>&1

Re: Can't get dub dustmite to work

2020-04-27 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 26 April 2020 at 22:05:20 UTC, aliak wrote: On Saturday, 25 April 2020 at 19:00:55 UTC, Anonymouse wrote: On Saturday, 25 April 2020 at 09:38:59 UTC, aliak wrote: Then I run this dub dustmite command: dub dustmite -b unittest ../dubdust --compiler-regex="never matches" I have had

Compilation memory use

2020-05-04 Thread Anonymouse via Digitalmars-d-learn
TL;DR: Is there a way to tell what module or other section of a codebase is eating memory when compiling? I'm keeping track of compilation memory use using zsh `time` with some environmental variables. It typically looks like this. ``` $ time dub build -c dev Performing "debug" build using /u

Re: Is there a way to tell if an auto ref parameter is by ref or by value?

2020-05-09 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 10 May 2020 at 00:33:07 UTC, NaN wrote: Ie something like.. auto Foo(T)(auto ref T x) { static if (isByRef(x)) { } else { } } __traits(isRef, x)

Re: Dub platform probes

2020-05-25 Thread Anonymouse via Digitalmars-d-learn
On Monday, 25 May 2020 at 22:58:54 UTC, Tim wrote: [...] Same here, but /tmp. $ ls /tmp/dub* | wc -l 174

Re: std.concurrency.receive and shared const(char)[]?

2020-06-28 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 28 June 2020 at 16:11:50 UTC, BakedPineapple wrote: import std.stdio; import std.concurrency; void main() { auto t = spawn((){ receive((shared const(char)[] char_arr) { ownerTid.send(true); }); }); shared

Re: Send empty assoc array to function

2020-07-09 Thread Anonymouse via Digitalmars-d-learn
On Thursday, 9 July 2020 at 19:53:42 UTC, JN wrote: void foo(int[int] bar) { // ... } Is it possible to send an empty array literal? foo( [ 0 : 2 ] ) works foo( [] ) doesn't int[int] empty; foo(empty); works but it's two lines I always did foo((int[int]).init);

Re: getopt: How does arraySep work?

2020-07-14 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 11:12:06 UTC, Andre Pany wrote: [...] Steven Schveighoffer already answered while I was composing this, so discarding top half. As far as I can tell the default arraySep of "" splitting the argument by whitespace is simply not the case. https://github.com/dlan

Re: My RPN calculator code review?

2020-07-18 Thread Anonymouse via Digitalmars-d-learn
On Friday, 17 July 2020 at 21:37:46 UTC, AB wrote: Hello, inspired by the "Tiny RPN calculator" example seen on the dlang homepage, I wanted to create my own version. I'd appreciate your opinions regarding style, mistakes/code smell/bad practice. Thank you. I generally don't know what I'm ta

Re: Cannot call @system funciton (stdout)

2020-08-16 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 16 August 2020 at 10:07:02 UTC, Simen Kjærås wrote: On Saturday, 15 August 2020 at 23:59:36 UTC, Joel wrote: ../../JMiscLib/source/jmisc/base.d(176,2): Error: @safe function jmisc.base.upDateStatus!string.upDateStatus cannot call @system function std.stdio.makeGlobal!"core.stdc.stdi

Introspecting a package for submodules

2020-08-24 Thread Anonymouse via Digitalmars-d-learn
I have some modules, and then one `package.d` file that publicly imports them all. I have reason to access them individually however, with hopes of being able to enumerate them and introspect with `__traits(allMembers, someModule)`. Concretely, I want to express "find all module-level classes i

Re: Introspecting a package for submodules

2020-08-24 Thread Anonymouse via Digitalmars-d-learn
On Monday, 24 August 2020 at 22:32:52 UTC, Anonymouse wrote: `__traits(allMembers, std.algorithm)` evaluates to nothing, but replace it with `std.algorithm.searching` and it does. `std.algorithm` makes for a bad example as it is actually empty save for imports. Just read it as `std.datetime` p

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main stdio thing I came across that I couldn't do from within @safe was stdout.flush(), which I need to call manually for Cygwin terminals and

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:32:07 UTC, Paul Backus wrote: On Saturday, 19 September 2020 at 13:23:29 UTC, Anonymouse wrote: On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main stdio

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 14:14:46 UTC, Paul Backus wrote: You can check the TERM environment variable [2], or you can use the POSIX uname() function [3] to see if you're running under Cygwin specifically. If there are any other environments where you need to manually set line-buffering

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 14:08:39 UTC, Adam D. Ruppe wrote: On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse wrote: Is there a way to detect programmatically if I'm in an environment where I need to manually set line buffering? Part of the problem is the IDE console and cygw

Re: Struct initializer in UDA

2020-09-26 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 26 September 2020 at 16:05:58 UTC, realhet wrote: Hi, struct S{int a, b, c=9, d, e, f;} Is there a way or a trick to declare an UDA by using a nice struct initializer? It would be nice to be able to use the form: @S{f:42} int a; //or something similar to this. instead of

Re: Struct initializer in UDA

2020-09-27 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 27 September 2020 at 10:17:39 UTC, realhet wrote: On Saturday, 26 September 2020 at 17:13:17 UTC, Anonymouse wrote: On Saturday, 26 September 2020 at 16:05:58 UTC, realhet wrote: The closest I can get is @(S.init.c(9).f(42)) with use of opDispatch, which is easier to read but still u

Re: Safe to remove AA elements while iterating over it via .byKeyValue?

2020-09-27 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 27 September 2020 at 13:02:04 UTC, Per Nordlöw wrote: Is it safe to remove AA-elements from an `aa` I'm iterating over via aa.byKeyValue? I'm currently doing this: foreach (ref kv; aa.byKeyValue) { if (pred(kv.key)) aa.remove(kv.key); // ok? } if

Taking arguments by value or by reference

2020-10-03 Thread Anonymouse via Digitalmars-d-learn
I'm passing structs around (collections of strings) whose .sizeof returns 432. The readme for 2.094.0 includes the following: This release reworks the meaning of in to properly support all those use cases. in parameters will now be passed by reference when optimal, [...] * Otherwise, if the

  1   2   3   >