Recommendations for best JSON lib?

2019-04-20 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
I only need to read arbitrary JSON data, no need for writing/(de)serialization.

Re: Cross compile windows programs on linux

2018-08-24 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/24/2018 12:30 PM, John Burton wrote: On Friday, 24 August 2018 at 15:26:30 UTC, kinke wrote: On Friday, 24 August 2018 at 13:10:40 UTC, John Burton wrote: Is in the subject. Are there any cross compilers that will run on a linux system but compile D code using Win32 into a windows .exe

Re: Generically call a function on Variant's payload?

2018-08-21 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/21/2018 03:27 PM, Steven Schveighoffer wrote: If you examine how the code for variant works, it's quite clever. It establishes a "handler" that is generated with full compile-time type info available when the value is *assigned*, but then cast to a function taking a void pointer and an

Re: Generically call a function on Variant's payload?

2018-08-21 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/21/2018 03:03 AM, Nicholas Wilson wrote: On Monday, 20 August 2018 at 00:27:04 UTC, Nick Sabalausky (Abscissa) wrote: Suppose I've wrapped a Variant in a struct/class which ensures the Variant *only* ever contains types which satisfy a particular constraint (for example: isInputRange, or

Re: Generically call a function on Variant's payload?

2018-08-21 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/20/2018 10:57 PM, Jonathan M Davis wrote: Runtime reflection is theoretically possible in D, but it requires generating the appropriate stuff for every type involved so that the runtime stuff has something to work with. Java built all of that into the language and has the JVM to boot,

Re: Generically call a function on Variant's payload?

2018-08-20 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/20/2018 04:34 PM, Jonathan M Davis wrote: foreach(T; TypesThatVariantHolds) Yea, that's what I would've just done, but I wanted to support user-created types not already known to my library. You can't just call functions on completely unknown types, because the compiler

Re: Generically call a function on Variant's payload?

2018-08-20 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/19/2018 11:31 PM, Paul Backus wrote: You are basically reinventing OOP here. Yes, I am. Deliberately, in fact. Class inheritance is my backup plan, though. My use-case is actually very, very similar to std.digest: There are various benefits to using a template-and-constraint based

Re: Generically call a function on Variant's payload?

2018-08-19 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/19/2018 10:23 PM, Jonathan M Davis wrote: On Sunday, August 19, 2018 6:33:06 PM MDT Nick Sabalausky (Abscissa) via Digitalmars-d-learn wrote: Maybe something involving using Variant.coerce to convert the payload to a single common type? Not sure how I would do that though. You could

Re: Generically call a function on Variant's payload?

2018-08-19 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 08/19/2018 08:27 PM, Nick Sabalausky (Abscissa) wrote: Suppose I've wrapped a Variant in a struct/class which ensures the Variant *only* ever contains types which satisfy a particular constraint (for example: isInputRange, or hasLength, etc...). Is there a way to call a function (ex:

Generically call a function on Variant's payload?

2018-08-19 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
Suppose I've wrapped a Variant in a struct/class which ensures the Variant *only* ever contains types which satisfy a particular constraint (for example: isInputRange, or hasLength, etc...). Is there a way to call a function (ex: popFront) on the Variant, *without* knowing ahead of time all

Re: docs/definition: !object

2018-03-08 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 03/08/2018 05:31 AM, Steven Schveighoffer wrote: On 3/8/18 1:00 AM, Nick Sabalausky (Abscissa) wrote: But are we CERTAIN that's all there is to it? I have a non-reduced situation right now where outputting the address of a class reveals a non-null address, and yet

Re: Can't "is null" an interface?!?! Incompatible types???

2018-03-08 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 03/08/2018 03:04 AM, Nick Sabalausky (Abscissa) wrote: Interesting. I was using vibe.d 'v0.8.3-rc.1' (which doesn't appear to work on run.dlang.io). But it does seem to work for me if I use 'v0.8.3-alpha.1'. I wonder what could have changed to result in this?

Re: Can't "is null" an interface?!?! Incompatible types???

2018-03-08 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 03/08/2018 01:13 AM, Nicholas Wilson wrote: That does seem odd. --- /+dub.sdl: dependency "vibe-d" version="~>0.8.3-alpha.1" +/ import vibe.core.net; import std.stdio; TCPConnection mySocket; void main() {     auto b = mySocket is null;     writeln(b); } --- works fine on run.dlang.io

Re: docs/definition: !object

2018-03-07 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 03/08/2018 12:05 AM, ketmar wrote: Nick Sabalausky (Abscissa) wrote: I'm having trouble finding the documentation for what exactly the unary "not" operator does when applied to a class/interface object. Does this documentation exist somewhere? I know at least part of it involves "is

docs/definition: !object

2018-03-07 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
I'm having trouble finding the documentation for what exactly the unary "not" operator does when applied to a class/interface object. Does this documentation exist somewhere? I know at least part of it involves "is null", but I seem to remember hearing there was more to it than just that.

Can't "is null" an interface?!?! Incompatible types???

2018-03-07 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
- import vibe.core.net; TCPConnection mySocket; void main() { auto b = mySocket is null; } - That's giving me: - Error: incompatible types for (mySocket) is (null): TCPConnection and typeof(null) - WTF?!?!

Spawning a process: Can I "have my cake and eat it too"?

2018-03-01 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
I'd like to include this functionality in Scriptlike, but I don't know if it's even possible: Launch a process (spawnProcess, pipeShell, etc) so the child's stdout/stderr go to the parent's stdout/stderr *without* the possibility of them getting inadvertently reordered/reinterleaved when

Tuts/Aritcles: Incrementasl C++-to-D conversion?

2018-02-21 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
Are there any tutorials or articles out there for "getting started with converting a C++ codebase to D one module at a time?" Or at the very least: tips, tricks, lessions learned, from those who have come before.

Re: No line numbers in stack trace (again)

2017-12-12 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 12/05/2017 08:43 AM, Nordlöw wrote: If I get the following stack trace ___without line numbers___ (instead ??:?) what's missing? Linux stack trace line numbers have disappeard for me, too. Used to work. Very frustrating, and a royal PITA when dealing with unittests. Help would be

Re: git workflow for D

2017-12-04 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 12/03/2017 03:05 PM, bitwise wrote: I've finally started learning git, due to our team expanding beyond one person - awesome, right? PROTIP: Version control systems (no matter whether you use git, subversion, or whatever), are VERY helpful on single-person projects, too! Highly

Re: Struct inside a class: How to get outer?

2017-12-03 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 12/03/2017 03:46 AM, bauss wrote: On Sunday, 3 December 2017 at 07:38:47 UTC, Jonathan M Davis wrote: As I understand it, there is no outer for nested structs, only nested classes. So, you'll either have to use a nested class or explicitly pass a reference to the outer class to the nested

Struct inside a class: How to get outer?

2017-12-02 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
Is this even possible? My attempts: class Outer { struct Inner { void foo() { // Error: no property 'outer' for type 'Inner' Outer o = this.outer; // Error: cannot implicitly convert expression

gdc-6.3.0 on travis borked?

2017-11-30 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
When using gdc-6.3.0 on travis-ci, travis is reporting that it can't download the compiler: -- $ source "$(CURL_USER_AGENT="$CURL_USER_AGENT" bash install.sh gdc-6.3.0 --activate)" curl: (22) The requested URL returned error: 404 Not Found

Re: Range tee()?

2017-10-16 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 10/16/2017 03:30 AM, lobo wrote: On Monday, 16 October 2017 at 07:28:03 UTC, Nick Sabalausky (Abscissa) wrote: Does Phobos have a way to "tee" a range? For example, suppose you had something like this: [...] https://dlang.org/phobos/std_range.html#tee ? Ahh, thanks, I was only looking

Range tee()?

2017-10-16 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
Does Phobos have a way to "tee" a range? For example, suppose you had something like this: - // Do something with each file in a dir dirEntries(selectedDir, SpanMode.shallow) .filter!someFilterCriteria .doSomethingWithFile;

Re: problem with std.variant rounding

2017-05-02 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 05/02/2017 04:02 AM, Suliman wrote: I need co concatenate string with variant type (I am doing SQL query). What is the best way to put it? It's seems that if I am doing simple `replace` string sql = "..." sql.replace(`37.72308`, to!string(cargpspoint.lon)).replace(`55.47957`,

Re: GC: Understanding potential sources of false pointers

2017-04-24 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 04/22/2017 08:56 AM, Kagamin wrote: .rdata is fine, but afaik you have only strings there, the rest - .data, .bss, .tls will suffer the same issue. I don't know anything about the various object file sections. :/

Re: GC: Understanding potential sources of false pointers

2017-04-20 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 04/20/2017 09:00 AM, Kagamin wrote: https://issues.dlang.org/show_bug.cgi?id=15723 Hmm, so apparently embedded data (even if it's from a C lib) can also be a source of false pointers. Thanks, good to know.

Re: Can we disallow appending integer to string?

2017-04-20 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 04/19/2017 01:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote: Yeah, which reduces the number of casts required when doing arithmetic on characters and thus reduces bugs there, Ugh, because apparently doing arithmetic on characters is such a common, important use-case in this modern

GC: Understanding potential sources of false pointers

2017-04-19 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
According to : "Registers, the stack, and any other memory locations added through the GC.addRange function are always scanned conservatively." 1. Can that be safely assumed to be a canonical list of all possible sources of false pointers? 2. What

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 10:36 PM, Adam D. Ruppe wrote: On Friday, 24 February 2017 at 02:50:27 UTC, Nick Sabalausky (Abscissa) wrote: What I'd kinda like to do is put together a D doc generator that uses, uhh, probably markdown. My dpldocs.info generator continues to progress and I'm almost ready to

Re: Big Oversight with readln?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 09:43 PM, Jonathan Marler wrote: I can't figure out how to make use of the full capacity of buffers that are allocated by readln. Take the example code from the documentation: // Read lines from $(D stdin) and count words void main() { char[] buf;

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 04:34 PM, Ali Çehreli wrote: (None of the following is tested.) a) Try using the following macro: COLON = And then use "Note$(COLON) Blah". Thanks, that works. c) Another option: NOTE = Note $0 Then use "$(NOTE Blah)" Actually, that's more or less what I was

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 04:49 PM, H. S. Teoh via Digitalmars-d-learn wrote: I'm becoming more and more convinced that software that tries to be smart ends up being even dumber than before. I've been convinced of that for a long time ;) Not just software either. Anything. My car does idiotic "smart"

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 04:51 PM, Adam D. Ruppe wrote: On Thursday, 23 February 2017 at 21:39:11 UTC, H. S. Teoh Apparently COLON is defined to be ':' in the default ddoc macros, so you needn't define it yourself. Oh yeah. Still, barf. Luckily in my case, the "Word:" part is already generated inside

ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
Suppose I want ddoc output to include this line: -- Note: Blah blabbety blah -- But the colon causes "Note" to be considered a section header. Is there a way to escape the ":" so that it's displayed as expected, but doesn't trigger a section?