Re: How programmers transition between languages

2018-01-29 Thread Mafi via Digitalmars-d
On Monday, 29 January 2018 at 11:48:07 UTC, Russel Winder wrote: [...] One thing that Go got almost right was the way of using FOSS packages and libraries. Rust, via Cargo, did a much better job. Go has a small standard library and allows use of any DVCS, there is no central contributed

Re: Json

2017-11-19 Thread Mafi via Digitalmars-d-learn
On Saturday, 18 November 2017 at 14:25:58 UTC, kerdemdemir wrote: I am using vibe.d's json(http://vibed.org/api/vibe.data.json/) module without a problem and really happy with it. There are also some examples(https://github.com/vibe-d/vibe.d/tree/master/examples/json). If you are using "dub"

Json

2017-11-17 Thread Mafi via Digitalmars-d-learn
What is the current best practice for parsing JSON in D? What library (on code.dlang.org) should I use? I do not want to (de-)serialize structs. Instead I want a simple DOM-API. Thank you very much :)

Re: Output-Range and char

2017-04-23 Thread Mafi via Digitalmars-d-learn
On Sunday, 23 April 2017 at 12:03:58 UTC, Ali Çehreli wrote: On 04/23/2017 04:17 AM, Mafi wrote: /opt/compilers/dmd2/include/std/range/primitives.d(351): Error: static assert "Cannot put a char into a char[]." Appender recommended: import std.format, std.stdio, std.array; void main() {

Output-Range and char

2017-04-23 Thread Mafi via Digitalmars-d-learn
Hi there, every time I want to use output-ranges again they seem to be broken in a different way (e.g. value/reference semantics). This time it is char types and encoding. How do I make formattedWrite work with a char buffer? I tried the following code and it fails with a *static assert*; it

Re: Unexpected behavior when casting away immutable

2015-09-23 Thread Mafi via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 05:24:05 UTC, John Colvin wrote: On Wednesday, 23 September 2015 at 03:39:02 UTC, Mike Parker wrote: ... ``` immutable int x = 10; int* px = cast(int*) *px = 9; writeln(x); ``` It prints 10, where I expected 9. This is on Windows. I'm curious if anyone

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Mafi via Digitalmars-d
On Friday, 5 June 2015 at 16:26:34 UTC, ketmar wrote: On Fri, 05 Jun 2015 15:17:50 +, Mafi wrote: auto int x = 10; should work. It's just consistent. then `auto auto` should work too. it's a declaration mark + storage class. Well, no. Any storage class marks a declaration just by

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Mafi via Digitalmars-d
On Friday, 5 June 2015 at 12:33:35 UTC, ketmar wrote: On Fri, 05 Jun 2015 11:53:29 +, Marc Schütz wrote: My understanding is that `auto` is just C legacy, and originally had the same meaning as in C. But apparently the language has moved away from that over time. i agree, i think it

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Mafi via Digitalmars-d
On Friday, 5 June 2015 at 10:56:36 UTC, ketmar wrote: p.s. if auto is a storage class, the following code should be accepted (while it isn't): int foo () { return 42; } void main () { auto auto i = foo(); } as it's logically an auto-typed var with auto storage class. Here lies

Re: stream == range ? [Sliding window]

2015-05-31 Thread Mafi via Digitalmars-d
On Sunday, 31 May 2015 at 17:50:41 UTC, Dmitry Olshansky wrote: 2. If we were to reuse algorithms - most algorithms love ForwardRange. And there is a problem implementing it for streams in the _range_ API itself. Yeah, most streams are seekable like e.g. files or MM-files, so they must be

Re: [hackathon] An article about metaprogramming

2015-04-29 Thread Mafi via Digitalmars-d
On Wednesday, 29 April 2015 at 16:55:58 UTC, bearophile wrote: Mafi: https://marfisc.wordpress.com/2015/04/29/using-d-templates-for-gamedev/ What do you think? Any remarks? The SDL_Event is a union. Accessing it is inherently unsafe for type consistency and memory safety. The SDL library

[hackathon] An article about metaprogramming

2015-04-29 Thread Mafi via Digitalmars-d
Hello there, I took the occasion of the D hackathon to finally write a technical article. I am programming games as a hobby and find the D programming language perfectly suited for this task. So I thought I could write an article about how I use D's capabilities to program games efficiently.