Logging Function Parameters

2018-03-17 Thread dom via Digitalmars-d-learn
Hi, I am looking for a method to log the current function name + parameters. Getting the name of the current function is simply possible with __PRETTY_FUNCTION__ Is there some possibility to generically access the parameters of a function such that they can be iterated and printed out?

Re: Why I am switching to Go

2016-09-21 Thread dom via Digitalmars-d
14 months ago i tried to write my first webapp. initially i chose vibe.d to be my framework. i got a simple app running quickly, but due to my lack of knowledge about webapps in general i got stuck at rather fundamental things. like doing authentication over oauth, or even have a rough

Re: Poodinis (DI framework) 7.0.0 released

2016-09-05 Thread dom via Digitalmars-d-announce
cool! i really like poodinis. it powers one of my projects and is very intuitive and simple to me :)

Re: Removing array element in foreach, safe?

2016-09-05 Thread dom via Digitalmars-d-learn
On Monday, 5 September 2016 at 17:38:10 UTC, Daniel Kozak wrote: On Monday, 5 September 2016 at 15:53:39 UTC, dom wrote: is this code safe? if not how do i do it correctly? static AsyncHttpGet[] openRequests; static void updateRequests() { foreach(idx,

Re: delegates, lambdas and functions pitfall

2016-09-05 Thread dom via Digitalmars-d-learn
On Monday, 5 September 2016 at 12:32:49 UTC, Lodovico Giaretta wrote: On Monday, 5 September 2016 at 12:15:35 UTC, dom wrote: [...] You misunderstood the error message and the lambda syntax (it also happened to me the first time). The grammar says that you can use one of these syntaxes:

Re: delegates, lambdas and functions pitfall

2016-09-05 Thread dom via Digitalmars-d-learn
On Monday, 5 September 2016 at 12:30:37 UTC, Daniel Kozak wrote: Dne 5.9.2016 v 14:15 dom via Digitalmars-d-learn napsal(a): ... but what is the difference between a lambda (=>) and a functions/delegates? i think this is a major pitfall for newcomers, and should be adressed somehow.

Removing array element in foreach, safe?

2016-09-05 Thread dom via Digitalmars-d-learn
is this code safe? if not how do i do it correctly? static AsyncHttpGet[] openRequests; static void updateRequests() { foreach(idx, req; openRequests) { if(req.state != Fiber.State.TERM)

delegates, lambdas and functions pitfall

2016-09-05 Thread dom via Digitalmars-d-learn
I am about to write my own stupid and simple http client .. and i have added a callback function that has the received content as a parameter. class AsyncHttpGet { this(string host, ushort port, string path, void delegate(string) callback ) { ... } } My first attempt was to write:

Re: Classes and Structs, Memory management questions

2016-09-02 Thread dom via Digitalmars-d-learn
On Friday, 2 September 2016 at 08:59:38 UTC, Andrea Fontana wrote: On Friday, 2 September 2016 at 08:54:33 UTC, dom wrote: i haven't read it fully yet, but i think this DIP contains some or all of my concerns https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md Check this:

Re: Classes and Structs, Memory management questions

2016-09-02 Thread dom via Digitalmars-d-learn
i haven't read it fully yet, but i think this DIP contains some or all of my concerns https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md

Classes and Structs, Memory management questions

2016-09-02 Thread dom via Digitalmars-d-learn
from what i got Classes are always reference types and structs are value types in D. i am wondering why that is. for me the main difference between classes and structs is not how they are allocated, but that one has inhertiance, and the other hasn't. Supporting inheritance has some overhead,

C# 7 Features - Tuples

2016-08-25 Thread dom via Digitalmars-d
https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/ came across the new c# features today. I really liked the syntax for Tuples (and deconstructors), would be great to have a similar syntax in D :)

to auto or not to auto ( in foreach )

2016-07-16 Thread dom via Digitalmars-d-learn
foreach(auto v; msg) writeln(v); gives an error that a basic type is expected foreach(v; msg) writeln(v); works .. but why?

Bug? somearrayofclassinstances.filter(...).array fails because of .init() method in class

2016-07-15 Thread dom via Digitalmars-d-learn
i just had a scenario like the one below. when calling .array on the filterresult dmd goes nuts because of the init() function in Players. Renaming to initialize() solved the problem. Solution: As .init is used for struct initialization and such (https://dlang.org/spec/property.html#init) i

Re: cant run unittests

2016-07-14 Thread dom via Digitalmars-d-learn
On Thursday, 14 July 2016 at 00:33:50 UTC, ethgeh wrote: On Wednesday, 13 July 2016 at 19:41:53 UTC, dom wrote: how can i run my unittests for a dynamic library? some weird conflict is reported between main functions, my project doesnt contain any main function. [...] try to put this

cant run unittests

2016-07-13 Thread dom via Digitalmars-d-learn
how can i run my unittests for a dynamic library? some weird conflict is reported between main functions, my project doesnt contain any main function. i really love D, but problems like this make me wanna switch :/ using: dub test --arch=x86 lucy ~master: building configuration

Re: compile shared lib with dub

2015-06-25 Thread dom via Digitalmars-d-learn
ok i actually did everything right x3 ... but my code threw some warnings which are interpreted as errors by default. /solved

compile shared lib with dub

2015-06-25 Thread dom via Digitalmars-d-learn
i want to build a shared library (.so) with dub. currently i compile with a shell script, but i'd like to use dub [code] dmd -c test.d -fPIC dmd -ofcod4xalicebridge.so test.o -shared -g -w -debug -version=Have_cod4xalicebridge [/code] could anyone tell me how my dub.json has to look like?