Re: Unresolvable dependencies to package

2023-04-14 Thread el machine code via Digitalmars-d-learn
so my question why am i'm getting this error and how do i fix this?

Unresolvable dependencies to package

2023-04-14 Thread el machine code via Digitalmars-d-learn
I just added dub add inochi-creator then dub run but got the error: ``` Unresolvable dependencies to package bindbc-sdl: bindbc-imgui 0.7.0 depends on bindbc-sdl ~>0.21.4 inochi-creator 0.7.4 depends on bindbc-sdl ~>1.1.2 ``` the dub.json looks like this: ``` { "authors": [

Re: what's the proper way to assign this?

2022-01-04 Thread Dr Machine Code via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 19:06:52 UTC, Ali Çehreli wrote: On 1/4/22 10:53 AM, Dr Machine Code wrote: what made that change, assuming it worked at time. Library? compile changes? Here is the changelog item: https://dlang.org/changelog/2.088.0.html#remove-nullable-alias-get-this A

Re: what's the proper way to assign this?

2022-01-04 Thread Dr Machine Code via Digitalmars-d-learn
On Tuesday, 4 January 2022 at 17:58:05 UTC, Adam D Ruppe wrote: On Tuesday, 4 January 2022 at 17:23:11 UTC, Dr Machine Code wrote: I could fix just with ```d data.entries ~= entry.get; ``` This is what the original code was doing - it used to implicitly do this. So while this

what's the proper way to assign this?

2022-01-04 Thread Dr Machine Code via Digitalmars-d-learn
I've tried to build 2 years old D project and I was getting the error: > Error: cannot append type `Nullable!(SelectorEntry)` to type `SelectorEntry[]` I went to use Nullable, 'cause I've never used it before. Boiling down the error was something like (minimal code reproduction): ```d

what the closest thing we have to racket's check_expect()?

2021-12-22 Thread Dr Machine Code via Digitalmars-d-learn
it differ from assert because it contains the expression, file and line information. See this https://stackoverflow.com/questions/14420857/check-expect-example-in-racket what's the closest thing we have in D? can we make it without compiler builtin?

Re: Simple text editor program

2021-11-17 Thread Dr Machine Code via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 03:21:34 UTC, Ali Çehreli wrote: On 11/16/21 6:10 PM, pascal111 wrote: Is there a so simple text editor written in D as an example for learners. I hope the editor whose code is written in D is available with someone. I am not familiar with any of them but

Re: How to use dmd code coverage

2021-11-12 Thread Dr Machine Code via Digitalmars-d-learn
On Thursday, 11 November 2021 at 23:51:42 UTC, foxit wrote: On Thursday, 11 November 2021 at 22:35:21 UTC, forkit wrote: [...] Actually, the reason I got soo confused is clear to me now. I have my own GUI IDE, which I wrote myself (winforms/C#) cause I got so fed up with creating/saving

Re: Are there anything like leetcode.com but that supports D?

2021-11-02 Thread Dr Machine Code via Digitalmars-d-learn
On Friday, 29 October 2021 at 17:29:57 UTC, harakim wrote: On Sunday, 24 October 2021 at 05:46:48 UTC, Dr Machine Code wrote: I'd like that to some friends getting start with programming. Sadly that platform doesn't support D. I wouldn't mind helping out by reviewing code or answering

Re: Are there anything like leetcode.com but that supports D?

2021-10-27 Thread Dr Machine Code via Digitalmars-d-learn
On Thursday, 28 October 2021 at 01:29:41 UTC, Siarhei Siamashka wrote: On Sunday, 24 October 2021 at 05:46:48 UTC, Dr Machine Code wrote: I'd like that to some friends getting start with programming. There are also websites, which host programming competitions. Beginners friendly: *

Re: Error: Could not open 'libcmt.lib'

2021-10-25 Thread Dr Machine Code via Digitalmars-d-learn
On Monday, 25 October 2021 at 15:43:06 UTC, Willem wrote: I was able to resolve above issues by following the install guide by DrIggy @ https://www.youtube.com/watch?v=fuJBj_tgsR8 Thanks for posting it. Willem A friend of mine was with this issue. We just end up using ldc2 but would be

Re: Are there anything like leetcode.com but that supports D?

2021-10-24 Thread Dr Machine Code via Digitalmars-d-learn
On Sunday, 24 October 2021 at 19:14:59 UTC, Imperatorn wrote: On Sunday, 24 October 2021 at 05:46:48 UTC, Dr Machine Code wrote: I'd like that to some friends getting start with programming. Sadly that platform doesn't support D. https://exercism.org/tracks/d also good one, thanks

Re: Are there anything like leetcode.com but that supports D?

2021-10-24 Thread Dr Machine Code via Digitalmars-d-learn
On Sunday, 24 October 2021 at 12:49:03 UTC, jfondren wrote: On Sunday, 24 October 2021 at 05:46:48 UTC, Dr Machine Code wrote: I'd like that to some friends getting start with programming. Sadly that platform doesn't support D. Here are a few: https://www.codingame.com/ https://www.spoj.com/

Are there anything like leetcode.com but that supports D?

2021-10-23 Thread Dr Machine Code via Digitalmars-d-learn
I'd like that to some friends getting start with programming. Sadly that platform doesn't support D.

Re: Question about generation of template functions

2019-08-29 Thread Machine Code via Digitalmars-d-learn
That's right, thank you all guys. Found my mistake; should be: serialize!(typeof(field))(__traits(getMember, output, fieldName));

Question about generation of template functions

2019-08-28 Thread Machine Code via Digitalmars-d-learn
I was writing a recursive function that uses template, I thought it would generate the proper template function on the fly to match the type in the parameter but it seems to not so so and try to use the called function, resulting in the error: Error: function foo.serialize!(B).serialize(ref B

Re: Sort Associative Array by Key

2019-08-27 Thread Machine Code via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 16:25:00 UTC, Samir wrote: On Sunday, 25 August 2019 at 17:01:23 UTC, a11e99z wrote: auto foo = ["VXE":8, "BZP":5, "JLC":2]; foo.byPair.array.sort!"a[0] On Sunday, 25 August 2019 at 19:03:10 UTC, JN wrote: I think normal lambdas are better than these string ones:

Re: static variable A cannot be read at compile time

2019-06-12 Thread Machine Code via Digitalmars-d-learn
On Wednesday, 12 June 2019 at 14:09:08 UTC, Newbie2019 wrote: On Wednesday, 12 June 2019 at 13:53:09 UTC, H. S. Teoh wrote: On Wed, Jun 12, 2019 at 01:12:58PM +, Newbie2019 via Digitalmars-d-learn wrote: Read: https://wiki.dlang.org/User:Quickfur/Compile-time_vs._compile-time T

Re: Function parameters UDAs

2019-06-10 Thread Machine Code via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 02:24:49 UTC, Adam D. Ruppe wrote: On Tuesday, 11 June 2019 at 02:04:13 UTC, Machine Code wrote: I also, quite disappointed how UDAs doesn't work with enums. I end up using struct + enum to simulate that, sometimes it's quite a work. They do now... struct foo {}

Re: Function parameters UDAs

2019-06-10 Thread Machine Code via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 16:28:19 UTC, Radu wrote: Looks like that there is no easy way to extract a function parameters UDA list. The following: ``` import std.traits; struct s { string foo; } void foo(@s("aaa") int a, bool x); void main() { alias P = Parameters!foo; enum

Re: Why this fails when using unittest?

2019-06-07 Thread Machine Code via Digitalmars-d-learn
On Friday, 7 June 2019 at 16:41:12 UTC, Adam D. Ruppe wrote: On Friday, 7 June 2019 at 16:33:13 UTC, Machine Code wrote: All this effort is because I do not want unittest code in a release or even debug. Well, that part is easy: version(unittest) struct Foo {} at any scope is only build

Re: Why this fails when using unittest?

2019-06-07 Thread Machine Code via Digitalmars-d-learn
On Friday, 7 June 2019 at 16:30:34 UTC, Machine Code wrote: On Thursday, 6 June 2019 at 21:02:37 UTC, Steven Schveighoffer wrote: [...] Intesting, I also tried to declare it inside a function, that did not work either. Is this hidden context pointer a current limitation in CTFE? I've tried

Re: Why this fails when using unittest?

2019-06-07 Thread Machine Code via Digitalmars-d-learn
On Thursday, 6 June 2019 at 21:02:37 UTC, Steven Schveighoffer wrote: On 6/6/19 1:49 PM, Adam D. Ruppe wrote: On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote: outside an unittest, this compiles fine: struct A try making it `static struct` instead cannot implicitly convert

Re: Why this fails when using unittest?

2019-06-07 Thread Machine Code via Digitalmars-d-learn
On Thursday, 6 June 2019 at 17:49:58 UTC, Adam D. Ruppe wrote: On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote: outside an unittest, this compiles fine: struct A try making it `static struct` instead didn't work either cannot implicitly convert expression "hehe" of

Re: Why this fails when using unittest?

2019-06-06 Thread Machine Code via Digitalmars-d-learn
On Thursday, 6 June 2019 at 17:40:17 UTC, Machine Code wrote: outside an unittest, this compiles fine: struct A { enum A foo = "hehe"; this(string a) { m_a = a; } alias m_a this; string m_a; } but if you

Why this fails when using unittest?

2019-06-06 Thread Machine Code via Digitalmars-d-learn
outside an unittest, this compiles fine: struct A { enum A foo = "hehe"; this(string a) { m_a = a; } alias m_a this; string m_a; } but if you wrap this a unittest {} and compile with dmd -unittest -run

Re: get executable version

2019-05-31 Thread Machine Code via Digitalmars-d-learn
On Friday, 31 May 2019 at 19:22:03 UTC, rikki cattermole wrote: On 01/06/2019 7:07 AM, Machine Code wrote: is there something on std library or package on dub to get a executable version on windows? just in case I don't need to dig into winapi. Like C#'s:

get executable version

2019-05-31 Thread Machine Code via Digitalmars-d-learn
is there something on std library or package on dub to get a executable version on windows? just in case I don't need to dig into winapi. Like C#'s: FileVersionInfo.GetVersionInfo(path).FileVersion

Re: [windows] Can't delete a closed file?

2019-05-10 Thread Machine Code via Digitalmars-d-learn
On Thursday, 9 May 2019 at 10:09:23 UTC, Cym13 wrote: Hi, this is likely not related to D itself but hopefully someone can help me with this since I'm rather new to windows programming, I mainly work on linux. I'm trying to bundle a DLL in a binary, write it in a temp folder, use it and

Re: How do I pass a template type as parameter?

2019-04-16 Thread Machine Code via Digitalmars-d-learn
On Tuesday, 16 April 2019 at 21:24:54 UTC, Adam D. Ruppe wrote: On Tuesday, 16 April 2019 at 21:07:51 UTC, Machine Code wrote: void f(appender!string buffer) { } appender isn't a type, it is a helper function that returns a type called Appender:

How do I pass a template type as parameter?

2019-04-16 Thread Machine Code via Digitalmars-d-learn
I've tried those syntaxes: void f(appender!string buffer) { } void f(A = appender)(A!string buffer) { } but no luck... how do I do that?

Re: default construction is disabled for type

2019-03-05 Thread Machine Code via Digitalmars-d-learn
So I find out the issue: it was due a struct member of the class having @disable this();

Re: default construction is disabled for type

2019-03-05 Thread Machine Code via Digitalmars-d-learn
public this() { } Doesn't change anything...

default construction is disabled for type

2019-03-05 Thread Machine Code via Digitalmars-d-learn
What's that error? below code used to work fine, now it gives this compiler error. class Keyword { this(string value, Token type) { this.value = value; this.type = type; } string value; Token type; Keyword next; }

Re: What's that 'q' before '{' in this code?

2019-01-15 Thread Machine Code via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 17:56:10 UTC, SrMordred wrote: On Tuesday, 15 January 2019 at 17:52:35 UTC, Machine Code wrote: https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d#L75 https://dlang.org/spec/lex.html#token_strings :) I had just infered from the commend in the code

What's that 'q' before '{' in this code?

2019-01-15 Thread Machine Code via Digitalmars-d-learn
https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d#L75

Do I need to use static here?

2019-01-08 Thread Machine Code via Digitalmars-d-learn
I'm using enum to compute the value at runtime like this: struct A { enum foo = A("foo", 10); enum baa = A("baa", 20); string name; int value; alias value this; } In order to avoid foo having its value (even if literal) copied every time A instancied

Re: What's wrong with this template function?

2019-01-03 Thread Machine Code via Digitalmars-d-learn
On Thursday, 3 January 2019 at 21:41:44 UTC, Neia Neutuladh wrote: On Thu, 03 Jan 2019 20:34:17 +, Machine Code wrote: Thank you very much, Ali. So the issue was basically I can't return from a static foreach() loop right? The static foreach is done at compile time and the return is done

Re: What's wrong with this template function?

2019-01-03 Thread Machine Code via Digitalmars-d-learn
On Thursday, 3 January 2019 at 19:38:39 UTC, Ali Çehreli wrote: On 01/03/2019 10:49 AM, Machine Code wrote: > I wrote a small routine to return the first member I see that that's possible because the values of such members are known at compile time in your case. Otherwise, you would need a

What's wrong with this template function?

2019-01-03 Thread Machine Code via Digitalmars-d-learn
I wrote a small routine to return the first member of type T of a same type, like struct below, but the assert is reached albeit the "yes" message is printed. What am I missing? should I use something else than return keyword to return from a template function or what? struct Color {

Re: Are the below statements equivalent?

2018-12-27 Thread Machine Code via Digitalmars-d-learn
On Wednesday, 26 December 2018 at 18:03:44 UTC, Adam D. Ruppe wrote: On Wednesday, 26 December 2018 at 17:33:13 UTC, Machine Code wrote: Are the below statements equivalent? Yes, it is defined here: https://dlang.org/spec/statement.html#switch-statement (#2 in the list) Thanks!

Are the below statements equivalent?

2018-12-26 Thread Machine Code via Digitalmars-d-learn
Give: enum Foo { a, b, c, d, e } Foo f = Foo.c; Are the below statements equivalent? switch(f) { case Foo.a: case Foo.b: doSomething(); break; // ... } and: (note the comma in the case) switch(f) { case Foo.a, Foo.b: doSomething(); break; // ... } I found it