Is unix time function in wrong module?

2021-05-19 Thread Martin via Digitalmars-d-learn
Hi, shouldn't the unix time functions be in std.datetime.Date and std.datetime.DateTime instead of std.datetime.SysTime? The documentation states: - "std.datetime.systime for a point in time with a timezone." - "std.datetime.date for points in time without timezones." Unix epoch is 00:00:00 U

Re: How do I create classes dynamically?

2021-04-15 Thread Martin via Digitalmars-d-learn
On Wednesday, 14 April 2021 at 20:38:16 UTC, Mario wrote: I wanted to find out if it is possible to create classes dynamically. out of curiosity: Why you would like to do this? I cannot think of a use case for this - this is why i ask.

null and initialized string comparisons

2021-02-17 Thread Martin via Digitalmars-d-learn
Hi, is this how it supposed to be? (https://run.dlang.io/is/7B4irm) --- string a = null; string t = ""; assert( ! a ); assert( t ); assert( t == a ); --- I have not expected assert(t == a) to be true - i would like to know the argument for why this is correct when at the same time assert(!a)

Tuple or struct as return type?

2021-02-06 Thread Martin via Digitalmars-d-learn
Hi, lets say i want to create a function that returns multiple values - e.g. Tuple!(string,string). Why/when i should prefer Tuple as a return type over returning a struct (or even string[2] in this case)? Thank you

Re: why is "hello".writeln considered bad?

2020-11-20 Thread Martin via Digitalmars-d-learn
On Friday, 20 November 2020 at 10:03:18 UTC, Daniel Kozak wrote: I remember days when I liked UFCS too . Unfortunately it is not so awesome when you use it with IDE. And I would like to add: if you use in a bigger team. It's annoying when every dev have a own taste.. And together with option

Re: magically a static member on init?

2020-11-15 Thread Martin via Digitalmars-d-learn
On Sunday, 15 November 2020 at 00:29:41 UTC, H. S. Teoh wrote: if you don't like the semantics, don't use it; always allocate the field in the class ctor instead. Hi, i neither like it nor dislike it - it just caught me by surprise because i was under the impression that if i create a new ins

Re: magically a static member on init?

2020-11-14 Thread Martin via Digitalmars-d-learn
On Saturday, 14 November 2020 at 23:30:58 UTC, Adam D. Ruppe wrote: On Saturday, 14 November 2020 at 23:20:55 UTC, Martin wrote: Is this intentional? [...] alright, thank you! :)

magically a static member on init?

2020-11-14 Thread Martin via Digitalmars-d-learn
Hi, i do no know if this is intended - but imo this is weird: https://run.dlang.io/is/eBje3A I expected that `c.a.str == ""` (just like `c.str` is). But instead `c.a.str` keeps the value of `b.a.str`. Is this intentional? IMO this feels not consistent and its weird when a reference leaks into

Re: vibe.d / experience / feedback

2020-10-03 Thread Martin via Digitalmars-d-learn
On Friday, 2 October 2020 at 09:46:09 UTC, Denis Feklushkin wrote: Because standard implementation worse? What do you mean with "worse"? In my experience std.json is a very thin implementation of the JSON spec - without/very low "magic". IMO this is what one wants in a std lib. Its a good sta

passing a parrameter read-only ref?

2020-09-13 Thread Martin via Digitalmars-d-learn
Hi, i would like to create a function which takes the first parameter as a reference to a struct - but assure the calle that the reference is read-only. Can this be done? If i am not mistaken, then the "in" Parameter Storage Class is what i want(?). But the documentation states that this feat

Re: How to compile Windows exe files from this source

2020-08-12 Thread Martin via Digitalmars-d-learn
On Sunday, 9 August 2020 at 19:04:07 UTC, Marc wrote: I don't know much more about D than creating a 'hello world' exe file with the DMD Compiler but I'm interested in using the eBay/tsv-utils binaries. Unfortunately, the author didn't create any MS Windows binaries: https://github.com/eBay/tsv-

Re: Factory pattern for classes

2020-08-10 Thread Martin via Digitalmars-d-learn
On Sunday, 9 August 2020 at 15:56:31 UTC, Ali Çehreli wrote: module deneme; import std.stdio; interface I { void methodName(); } ... I getClassById(uint id) { if (id == 0) { return cast(A)Object.factory("deneme.A"); } else if(id == 1) { return cast(B)Object.factory("de

Re: Polymorphism? Passing arguments

2017-11-03 Thread Martin via Digitalmars-d-learn
ok, thanks you very much for the information.

Re: Polymorphism? Passing arguments

2017-11-03 Thread Martin via Digitalmars-d-learn
Thank you for the answer On Saturday, 4 November 2017 at 01:35:41 UTC, Adam D. Ruppe wrote: Why are these ref? Just taking ref away from both of those will likely fix your problems. because without it i get the error "Program exited with code -11" The thing is, somwhere deeper in `setRelatio

Polymorphism? Passing arguments

2017-11-03 Thread Martin via Digitalmars-d-learn
I have a interface `interface Node {...}` and some classes implementing Node: ``` class Text : Node {...} class Element : Node {...} ``` and a function like this: `public void setRelation(ref Node parent , ref Node child) {...}` if i do this it works: ``` Node root = new Element("root"); Node te

how to harvest the results of tasks from a taskpool?

2017-07-05 Thread Martin via Digitalmars-d-learn
Hi, i have a coulpe of different machines with MySQL Servers running on it. Now, i want to execute queries for all Databases at the same time and collect the Result to process it. I am new to the parallelism - so maybe i understand something totaly wrong. What i tring is something like this

Re: Tuple/Typedef question

2015-01-11 Thread Martin via Digitalmars-d-learn
On Sunday, 11 January 2015 at 11:52:42 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 11 Jan 2015 11:41:08 + Martin via Digitalmars-d-learn wrote: Is there a way to get Tuple (and Typedef) from the std.typecons module to generate a new type that is unique on every instantiation

Tuple/Typedef question

2015-01-11 Thread Martin via Digitalmars-d-learn
Is there a way to get Tuple (and Typedef) from the std.typecons module to generate a new type that is unique on every instantiation? What I mean is: alias T1 = Tuple!(int, int); alias T2 = Tuple!(int, int); writeln(__traits(isSame, T1, T2)); // prints true When using Typedef, the types are stil

spawnProcess command-line arguments help

2014-08-03 Thread Martin via Digitalmars-d-learn
When I use the spawnProcess function in std.process, the command line arguments that I provide to the function seem to get "quoted". Is there a way to tell the spawnProcess function that I want the command line arguments to be non-quoted? Example: spawnProcess(["SomePath\\Test.exe"], ["-silent