Re: dub Fetches Wrong Package Version

2023-07-30 Thread Ruby The Roobster via Digitalmars-d-learn
On Saturday, 29 July 2023 at 17:11:50 UTC, Dennis wrote: On Saturday, 29 July 2023 at 16:47:34 UTC, Ruby The Roobster wrote: Dub refuses to fetch the ~master branch of a package, even when dub.json tells it to. Is there any workaround to this? Delete dub.selections.json, which locks in

dub Fetches Wrong Package Version

2023-07-29 Thread Ruby The Roobster via Digitalmars-d-learn
Dub refuses to fetch the ~master branch of a package, even when dub.json tells it to. Is there any workaround to this?

Re: Thread/Task cancellation

2023-07-28 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 28 July 2023 at 18:52:59 UTC, Ruby The Roobster wrote: On Friday, 28 July 2023 at 18:17:18 UTC, Gjiergji wrote: I am coming from a C# background. I understood that there is no async/await equivalent in D (except fibers which are not suitable for multi threading), but if I am using

Re: Thread/Task cancellation

2023-07-28 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 28 July 2023 at 18:17:18 UTC, Gjiergji wrote: I am coming from a C# background. I understood that there is no async/await equivalent in D (except fibers which are not suitable for multi threading), but if I am using threads, what is the D idiom to implement cancellation? Usually a

Re: Perspective Projection

2023-07-28 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 28 July 2023 at 16:20:26 UTC, Dennis wrote: On Friday, 28 July 2023 at 16:08:43 UTC, Ruby The Roobster wrote: Everything displays fine (with orthographic projection, of course) if you leave the projection as the identity matrix, but setting it as I have done results in a blank

Perspective Projection

2023-07-28 Thread Ruby The Roobster via Digitalmars-d-learn
I again am having issues with OpenGL, this time with the projection matrix. Using gl3n, I have the following code: ```d // model matrix mat4 trans = mat4(0f); trans.make_identity(); trans = trans.rotatex(radians(-55)); // view matrix: mat4 view = mat4(0f);

Re: Loading Textures in OpenGL

2023-07-23 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 23 July 2023 at 17:45:53 UTC, Ferhat Kurtulmuş wrote: On Sunday, 23 July 2023 at 17:35:03 UTC, Ruby The Roobster [SNIP] Thank you. I'm still trying to work out how it works. It seems as if the creator tried the same thing that I did, and then commented it out. Perhaps for the

Re: Loading Textures in OpenGL

2023-07-23 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 23 July 2023 at 17:35:03 UTC, Ruby The Roobster wrote: On Sunday, 23 July 2023 at 17:02:40 UTC, Ferhat Kurtulmuş wrote: On Sunday, 23 July 2023 at 16:21:05 UTC, Ruby The Roobster wrote: I'm currently trying to load two textures and apply them to a rectangle, following

Re: Loading Textures in OpenGL

2023-07-23 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 23 July 2023 at 17:02:40 UTC, Ferhat Kurtulmuş wrote: On Sunday, 23 July 2023 at 16:21:05 UTC, Ruby The Roobster wrote: I'm currently trying to load two textures and apply them to a rectangle, following [this](https://learnopengl.com/Getting-started/Textures) which is linked to from

Loading Textures in OpenGL

2023-07-23 Thread Ruby The Roobster via Digitalmars-d-learn
I'm currently trying to load two textures and apply them to a rectangle, following [this](https://learnopengl.com/Getting-started/Textures) which is linked to from the README file of the bindbc OpenGL bindings. I'm using Gamut to load the files, with the file: ```d module texture; import

Re: Recommendation on plotting library

2023-07-21 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 20 July 2023 at 04:41:48 UTC, Chris Piker wrote: [SNIP] I just tried ggplotd and it was easy to make it work on Linux, only one external apt command needed, but on Windows, even that is a deal breaker. Package management on Windows seems to be wild-west/nonexistent. Try

Re: How to build a static lib properly?

2023-03-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Monday, 6 March 2023 at 00:55:04 UTC, ryuukk_ wrote: Hello, I am trying to build: https://github.com/dlang-community/DCD/ as a static lib [...] Try ```dub build --build-mode=allAtOnce```.

Re: Gneric linkedList range adaptor

2023-02-10 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 10 February 2023 at 23:39:11 UTC, Ruby The Roobster wrote: The problem is that Node.next is not, and cannot be `static`. Thus, there is no way for you to pass it as an alias template parameter, and this should be considered a compiler bug that this doesn't error out.

Re: Gneric linkedList range adaptor

2023-02-10 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 10 February 2023 at 22:10:20 UTC, Ben Jones wrote: I'm trying to write a range adaptor for linked list types. The range type seems to work OK, but my helper function to deduce the node type has a compiler error. My hunch is that `nextField` loses its association with T when I'm

How to get the body of a function/asm statement in hexadecimal

2023-01-29 Thread Ruby the Roobster via Digitalmars-d-learn
I'm trying to do something like ```d void main() { auto d = *d.writeln; } void c() { } ``` In an attempt to get the hexadecimal representation of the machine code of a function. Of course, function pointers cannot be dereferenced. What do? Furthermore, I would like to be able to

Re: vibe.d + mongoDB

2023-01-20 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 January 2023 at 18:58:16 UTC, seany wrote: Hi I am googling to find some vibe.d and mongoDB tutorial. Are their some available? Thank you There is a nice book, titled D Web Development, that despite being 6 years old, is still mostly applicable to using vibe.d. The only

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-20 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 January 2023 at 13:38:52 UTC, Hipreme wrote: On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear wrote: ... [snip] With a single file, you can do: ```d final class Algo { @disable this(); static: void drawLine(...){} } ``` This also works, but it

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-20 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 January 2023 at 13:38:47 UTC, evilrat wrote: On Friday, 20 January 2023 at 13:17:05 UTC, Ruby The Roobster ... [snip] Also there is various import options such as renamed import or static import(doesn't add module to a scope thus requiring to fully qualify it) static import,

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-20 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 January 2023 at 13:03:18 UTC, thebluepandabear wrote: ll a function without instantiating said class, as functions act on the class object. Ok, thanks. I think D should implement something similar to `static class` but I doubt it will happen. D isn't Java, and never will be.

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-20 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 January 2023 at 12:55:37 UTC, Ruby The Roobster wrote: On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear ... There is no way to implement that functionality in D. `final` means that the class cannot be extended, and `abstract` requires that only an extension of said

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-20 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear wrote: Hi, In Java/C# you can create purely static classes. These are classes whose methods are all static, the classes cannot be derived from or instantiated: ``` static class Algo { void drawLine(Canvas c, Pos from, Pos to)

Re: What is the 'Result' type even for?

2023-01-20 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 January 2023 at 03:39:48 UTC, H. S. Teoh wrote: On Fri, Jan 20, 2023 at 03:34:43AM +, Ruby The Roobster via Digitalmars-d-learn wrote: On Friday, 20 January 2023 at 03:30:56 UTC, Steven Schveighoffer wrote: > On 1/19/23 10:11 PM, Ruby The Roobster wrote: > ... > &g

Re: What is the 'Result' type even for?

2023-01-19 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 January 2023 at 03:30:56 UTC, Steven Schveighoffer wrote: On 1/19/23 10:11 PM, Ruby The Roobster wrote: ... The point is to be a range over the original input, evaluated lazily. Using this building block, you can create an array, or use some other algorithm, or whatever you

Re: What is the 'Result' type even for?

2023-01-19 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 January 2023 at 03:11:33 UTC, Ruby The Roobster wrote: Take this example: ```d import std; void main() { auto c = "a|b|c|d|e".splitter('|'); c.writeln; string[] e = ["a", "b", "c", "d", "e"]; assert(c.equal(e)); typeof(c).stringof.writeln; } ``` The program

What is the 'Result' type even for?

2023-01-19 Thread Ruby The Roobster via Digitalmars-d-learn
Take this example: ```d import std; void main() { auto c = "a|b|c|d|e".splitter('|'); c.writeln; string[] e = ["a", "b", "c", "d", "e"]; assert(c.equal(e)); typeof(c).stringof.writeln; } ``` The program prints: ["a", "b", "c", "d", "e"] Result What is the purpose of this

MacOS Weirdness

2023-01-16 Thread Ruby The Roobster via Digitalmars-d-learn
I just fixed a bug in my personal D hobby project. After pushing everything to github, I noticed that it fails to link with the latest LDC on MacOS. The error I'm getting is thus: ``` ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning:

Re: Proper way to exit with specific exit code?

2022-11-13 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 13 November 2022 at 21:16:32 UTC, mw wrote: On Saturday, 19 September 2020 at 06:11:15 UTC, Jacob Carlborg wrote: On 2020-09-17 16:58, drathier wrote: What's the proper way to exit with a specific exit code? I found a bunch of old threads discussing this, making sure destructors

Re: Interfacing with Rust

2022-09-30 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 30 September 2022 at 06:25:33 UTC, Imperatorn wrote: On Friday, 30 September 2022 at 00:18:42 UTC, Ruby The Roobster wrote: On Thursday, 29 September 2022 at 16:07:59 UTC, mw wrote: On Thursday, 29 September 2022 at 16:02:43 UTC, Ruby The Roobster wrote: Is there any way one can

Re: Interfacing with Rust

2022-09-29 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 29 September 2022 at 16:07:59 UTC, mw wrote: On Thursday, 29 September 2022 at 16:02:43 UTC, Ruby The Roobster wrote: Is there any way one can interface with Rust, such as with a struct, or a function? I know that rust has an extern keyword, but I can't get it to work.

Interfacing with Rust

2022-09-29 Thread Ruby The Roobster via Digitalmars-d-learn
Is there any way one can interface with Rust, such as with a struct, or a function? I know that rust has an extern keyword, but I can't get it to work.

Re: can not take const struct member address at CTFE , is this a bug?

2022-09-13 Thread Ruby The Roobster via Digitalmars-d-learn
On Tuesday, 13 September 2022 at 11:16:55 UTC, test123 wrote: ```d struct c { uint a, b;} __gshared const c d = { 3, 4}; __gshared const e = ``` ./test.d(4): Error: expression `(3u, 4u).a` is not a constant I need this to work around C struct array member like this: ```c struct

Re: This code completely breaks the compiler:

2022-08-19 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 19 August 2022 at 05:50:17 UTC, Mike Parker wrote: On Friday, 19 August 2022 at 04:25:25 UTC, Ruby The Roobster wrote: [...] If the template is never instantiated, it never makes it into the executable. It doesn't matter if it's in production or not, and has nothing to do with

Re: This code completely breaks the compiler:

2022-08-18 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 19 August 2022 at 04:16:28 UTC, JG wrote: On Friday, 19 August 2022 at 03:13:03 UTC, Ruby The Roobster wrote: On Friday, 19 August 2022 at 03:10:38 UTC, Ruby The Roobster wrote: This snippet compiles. Even if `dsds` and `sadsad` are defined nowhere, this code compiles. [SNIP]

Re: This code completely breaks the compiler:

2022-08-18 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 19 August 2022 at 03:10:38 UTC, Ruby The Roobster wrote: This snippet compiles. Even if `dsds` and `sadsad` are defined nowhere, this code compiles. [SNIP] The reason why this compiles is because of the varidic template parameter, `Mtypes`. Either there is something I'm

This code completely breaks the compiler:

2022-08-18 Thread Ruby The Roobster via Digitalmars-d-learn
This snippet compiles. Even if `dsds` and `sadsad` are defined nowhere, this code compiles. ```d import std.typecons : Tuple; sadsad executeFunction(Mtypes...)(dstring func, Tuple!(Mtypes) args) { static foreach(type; typel.keys) { mixin(typel[type] ~ " ret"d ~ type ~ ";");

dub-registry

2022-08-12 Thread Ruby The Roobster via Digitalmars-d-learn
I am currently trying to set up for myself a personal dub registry, and I have MongoDB installed. Yet, when I run `dub run` in the repo directory, I get the following error message: ```

Re: Array Wierdness

2022-08-10 Thread Ruby The Roobster via Digitalmars-d-learn
On Wednesday, 10 August 2022 at 15:50:45 UTC, Steven Schveighoffer wrote: On 8/10/22 11:26 AM, Ruby The Roobster wrote: [SNIP] A related bug: https://issues.dlang.org/show_bug.cgi?id=23140 -Steve Funnily enough, I came across this when trying to fix that same bug.

Re: Array Wierdness

2022-08-10 Thread Ruby The Roobster via Digitalmars-d-learn
On Wednesday, 10 August 2022 at 15:19:41 UTC, Ruby The Roobster wrote: Take the following code: ```d void main() { shared class C { bool opEquals(const(shared(C)) rhs) const shared { return true;}} const(C) c = new C(); const(C)[] a = [c]; const(C)[] b = [c]; assert(a[0]

Array Wierdness

2022-08-10 Thread Ruby The Roobster via Digitalmars-d-learn
Take the following code: ```d void main() { shared class C { bool opEquals(const(shared(C)) rhs) const shared { return true;}} const(C) c = new C(); const(C)[] a = [c]; const(C)[] b = [c]; assert(a[0] == b[0]); } ``` This code (supposedly) checks whether ```a``` and

Re: Arbitrary precision decimal numbers

2022-08-10 Thread Ruby The Roobster via Digitalmars-d-learn
On Saturday, 6 August 2022 at 13:20:19 UTC, Sergey wrote: On Thursday, 4 August 2022 at 13:01:30 UTC, Ruby The Roobster wrote: Is there any implementation in phobos of something similar to BigInt but for non-integers as well? If there isn't is there a dub package that does this, and if so,

Re: Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 17:02:48 UTC, Ruby The Roobster wrote: On Friday, 5 August 2022 at 16:58:25 UTC, Ruby The Roobster wrote: On Friday, 5 August 2022 at 15:07:18 UTC, H. S. Teoh wrote: [SNIP] In other words, you're trying to construct a BigInt with a value of 10^18030 (a number with

Re: Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 16:58:25 UTC, Ruby The Roobster wrote: On Friday, 5 August 2022 at 15:07:18 UTC, H. S. Teoh wrote: [SNIP] In other words, you're trying to construct a BigInt with a value of 10^18030 (a number with 18030 digits) and wondering why the computer is taking forever to

Re: Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 15:07:18 UTC, H. S. Teoh wrote: [SNIP] In other words, you're trying to construct a BigInt with a value of 10^18030 (a number with 18030 digits) and wondering why the computer is taking forever to compute the value. :-D [SNIP] T I have no idea how the program

Re: Arbitrary precision decimal numbers

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 14:11:10 UTC, frame wrote: On Friday, 5 August 2022 at 14:03:36 UTC, Ruby The Roobster wrote: Also, what about division and exponentiation. You can't just forward them to BigInt and get a good result, BigInt will just round to an integer for these two. There

Re: Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 14:11:09 UTC, H. S. Teoh wrote: On Fri, Aug 05, 2022 at 01:56:40PM +, Ruby The Roobster via Digitalmars-d-learn wrote: [...] public import dutils.math.core; Is the imported module available anywhere? I'm trying to run your code sample to determine what's

Re: Arbitrary precision decimal numbers

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 14:00:32 UTC, frame wrote: On Thursday, 4 August 2022 at 13:01:30 UTC, Ruby The Roobster wrote: Is there any implementation in phobos of something similar to BigInt but for non-integers as well? If there isn't is there a dub package that does this, and if so, which

Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
My code (as seen below) is failing due to a single line. That line is: ```d this.ival += (this.val * rhs.ival); ``` I kid you not, this is the reason why running unittests results in a program that just hangs. And no, replacing unittest with void main() doesn't fix the problem. ```d module

Re: Unittest Absurdity

2022-08-04 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 01:51:21 UTC, Ruby The Roobster wrote: On Friday, 5 August 2022 at 01:47:07 UTC, Ruby The Roobster wrote: On Friday, 5 August 2022 at 01:42:23 UTC, jfondren wrote: On Friday, 5 August 2022 at 01:38:48 UTC, jfondren wrote: Here's a complete example that passes

Re: Unittest Absurdity

2022-08-04 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 01:47:07 UTC, Ruby The Roobster wrote: On Friday, 5 August 2022 at 01:42:23 UTC, jfondren wrote: On Friday, 5 August 2022 at 01:38:48 UTC, jfondren wrote: Here's a complete example that passes tests: ```d struct S { int n; void opOpAssign(string op)(S rhs)

Re: Unittest Absurdity

2022-08-04 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 01:42:23 UTC, jfondren wrote: On Friday, 5 August 2022 at 01:38:48 UTC, jfondren wrote: Here's a complete example that passes tests: ```d struct S { int n; void opOpAssign(string op)(S rhs) if (op == "/") { n++; } } unittest { auto a = S(1),

Re: Unittest Absurdity

2022-08-04 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 01:23:40 UTC, Ruby The Roobster wrote: [SNIP] Any function other than an operator overload seems to work fine. Also, this isn't mentioned in the spec. Additional Information: Fails for both DMD and LDC on Windows x86_64 for dmd v2.100.1

Unittest Absurdity

2022-08-04 Thread Ruby The Roobster via Digitalmars-d-learn
How do I get unittests to actually execute operator overloads? E.g.: ```d struct Struct { void opOpAssign(string op)(Struct rhs) //Assume that the operator `/=` is implemented here { //... } } unittest { Struct a = Struct(1); Struct b = Struct(2); a /= b;

Arbitrary precision decimal numbers

2022-08-04 Thread Ruby The Roobster via Digitalmars-d-learn
Is there any implementation in phobos of something similar to BigInt but for non-integers as well? If there isn't is there a dub package that does this, and if so, which one?

Re: BigInt.toString

2022-08-03 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 4 August 2022 at 01:32:15 UTC, Salih Dincer wrote: I guess I wrote the following anything like that you want. ```d void main() { import std.bigint, std.string : representation; BigInt i = 1001; auto val = i.to!(dchar[]); assert(val.representation == [49, 48, 48,

Re: BigInt.toString

2022-08-03 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 4 August 2022 at 01:05:31 UTC, H. S. Teoh wrote: Don't call .toString directly. Instead, use std.format.format: ```d import std; void main() { auto x = BigInt("123123123123123123123123123123123123"); string s = format("%s", x); // this gives you the string representation

BigInt.toString

2022-08-03 Thread Ruby The Roobster via Digitalmars-d-learn
How exactly can one store the string representation of a BigInt? The seemingly obvious ```d //... dchar[] ret; //dchar[] is necessary for my project //Assume that val is a BigInt with a value set earlier: val.toString(ret, "%d"); //... ``` doesn't work. I am using x86_64 windows with -m64,

Re: Obsecure problem 2

2022-08-03 Thread Ruby The Roobster via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 19:11:51 UTC, pascal111 wrote: On Wednesday, 3 August 2022 at 18:53:35 UTC, jfondren wrote: On Wednesday, 3 August 2022 at 18:33:37 UTC, pascal111 wrote: I changed it to "x=notfunny(x);" and has the same result. Now you are changing the value of the temporary

Re: How to cast away shared?

2022-08-03 Thread Ruby The Roobster via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 13:00:05 UTC, Paul Backus wrote: On Wednesday, 3 August 2022 at 12:50:17 UTC, Ruby The Roobster wrote: Any way to 'cast away' shared for an unknown type T? There's actually an `Unshared` template for this in `std.traits`, but for some reason it's `private`, so

How to cast away shared?

2022-08-03 Thread Ruby The Roobster via Digitalmars-d-learn
Any way to 'cast away' shared for an unknown type T?

Re: How to call a function from a dll created with d ?

2022-07-07 Thread Ruby The Roobster via Digitalmars-d-learn
On Saturday, 2 July 2022 at 20:43:41 UTC, Vinod KC wrote: On Saturday, 2 July 2022 at 14:32:11 UTC, apz28 wrote: dmd -of=dimedll.dll dimedll.d dimedll.def dmd dime.d dimedll.di Thanks for the reply. Well, I am sorry to say that your suggestions resulted in failure. First of all, when I used

Re: How to call a function from a dll created with d ?

2022-07-01 Thread Ruby The Roobster via Digitalmars-d-learn
The solution is to remove the extern declaration. That does it for me, and it prints the expected output. No need for a .def file, unless you are using optlink as your linker (which, as a matter of principle, you should use lld or ld instead.)

Any way to define variables from one scope in another scope?

2022-06-20 Thread Ruby The Roobster via Digitalmars-d-learn
Is there any way to define variables in an outer scope from an inner scope? I was thinking ```d void main() { int .y = 3; } ``` would work, but it doesn't.

Re: Conpile-Time module constructor

2022-06-19 Thread Ruby The Roobster via Digitalmars-d-learn
On 6/19/2022 11:55 AM, Paul Backus wrote: On Sunday, 19 June 2022 at 15:34:48 UTC, Ruby The Roobster wrote: On 6/19/2022 11:19 AM, Paul Backus wrote: On Sunday, 19 June 2022 at 14:51:26 UTC, Ruby The Roobster wrote: Is it possible to make a module constructor run at compile-time?  If so, how?

Re: Conpile-Time module constructor

2022-06-19 Thread Ruby The Roobster via Digitalmars-d-learn
On 6/19/2022 11:19 AM, Paul Backus wrote: On Sunday, 19 June 2022 at 14:51:26 UTC, Ruby The Roobster wrote: Is it possible to make a module constructor run at compile-time?  If so, how? No, it's not. What are you trying to accomplish that lead you to ask this question? There is probably a

Conpile-Time module constructor

2022-06-19 Thread Ruby The Roobster via Digitalmars-d-learn
Is it possible to make a module constructor run at compile-time? If so, how?

Re: Anybody have any idea on how to do shared operator overloads?

2022-06-01 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 2 June 2022 at 01:29:39 UTC, Ruby The Roobster wrote: On Thursday, 2 June 2022 at 01:00:57 UTC, Ali Çehreli wrote: On 6/1/22 17:36, Ruby The Roobster wrote: > A stripped down version of some code I have: Not much experience here but I made two changes: 1) Added 'shared': >

Re: Anybody have any idea on how to do shared operator overloads?

2022-06-01 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 2 June 2022 at 01:00:57 UTC, Ali Çehreli wrote: On 6/1/22 17:36, Ruby The Roobster wrote: > A stripped down version of some code I have: Not much experience here but I made two changes: 1) Added 'shared': > this(Complex!real num = Complex!real(0,0)) shared > { >

Anybody have any idea on how to do shared operator overloads?

2022-06-01 Thread Ruby The Roobster via Digitalmars-d-learn
A stripped down version of some code I have: ```d public import std.complex; public interface Mtype { // ... } public class Number : Mtype { public: this(Complex!real num = Complex!real(0,0)) { this.num = num; } this(shared Complex!real num =

Re: Interface wierdness

2022-05-06 Thread Ruby The Roobster via Digitalmars-d-learn
On Saturday, 7 May 2022 at 00:48:20 UTC, Ruby The Roobster wrote: Define an interface that has a function that returns an object of the same type: .. Nevermind. I was being stupid and made a naming error.

Interface wierdness

2022-05-06 Thread Ruby The Roobster via Digitalmars-d-learn
Define an interface that has a function that returns an object of the same type: ```d interface I { I foo(); } ``` Now define a class that inherits that interface: ```d class M : I { this(int i) { this.i = i; } M foo() { return new M(42); } int

Unittests being broken

2022-05-04 Thread Ruby The Roobster via Digitalmars-d-learn
Some code I have: ```d alias Operator = dstring function(dstring input); //List of all operations. package Operator[dstring] opList; //List of all functions. package dstring[dstring] funcList; //Functions that may not be deleted. package dstring[dstring] noTouch; //Initialize the basic

Re: Dub says that there is an invalid semVer format, but I don't see how.

2021-11-20 Thread Ruby The Roobster via Digitalmars-d-learn
On Saturday, 20 November 2021 at 01:01:05 UTC, rikki cattermole wrote: Don't use ~> for branches. ... Thank you very much. I edited the dub.json, and that fixed the problem(anyways, there is no longer a "testing" branch, so that would have also been an issue.)

Re: Dub says that there is an invalid semVer format, but I don't see how.

2021-11-19 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 12 November 2021 at 21:22:32 UTC, Ruby The Roobster wrote: On Thursday, 11 November 2021 at 01:57:10 UTC, rikki cattermole wrote: On 11/11/2021 2:13 PM, Ruby The Roobster wrote: Branch ~master: Invalid SemVer format: testing.0.0 Branch ~testing: Invalid SemVer format: testing.0.0

Re: Dub says that there is an invalid semVer format, but I don't see how.

2021-11-12 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 11 November 2021 at 01:57:10 UTC, rikki cattermole wrote: On 11/11/2021 2:13 PM, Ruby The Roobster wrote: Branch ~master: Invalid SemVer format: testing.0.0 Branch ~testing: Invalid SemVer format: testing.0.0 Version 0.1.2: Invalid SemVer format: testing.0.0 testing is a branch.

Dub says that there is an invalid semVer format, but I don't see how.

2021-11-10 Thread Ruby The Roobster via Digitalmars-d-learn
# Dub says that there is an invalid semVer format, but I don't see how. [Relevant Package:](https://code.dlang.org/packages/dutils) Recently, I added a new tag: v0.1.2 to the github repo, as well as v0.1.2-rc.1(this was later removed.) Now whenever updating the package, dub gives me this:

Re: Strange multithreading error

2021-10-29 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 29 October 2021 at 23:32:38 UTC, Steven Schveighoffer wrote: On Friday, 29 October 2021 at 22:02:53 UTC, Ruby The Roobster wrote: I am currently writing a test program for a collision function, that involves multithreading so I can simultaneously check for collisions and move a

Strange multithreading error

2021-10-29 Thread Ruby The Roobster via Digitalmars-d-learn
I am currently writing a test program for a collision function, that involves multithreading so I can simultaneously check for collisions and move a skeleton at the same time. Because of this, I had to use ```shared``` objects. The specific objects I was using were declared in a file called

Re: Dub failing to use the linker correctly.

2021-10-22 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 22 October 2021 at 21:57:02 UTC, Ruby The Roobster wrote: On Friday, 22 October 2021 at 21:21:41 UTC, jfondren wrote: On Friday, 22 October 2021 at 19:56:37 UTC, Ruby The Roobster wrote: I have a simple vibe-d project built with dub. Running the command, dub build --force returns

Re: Dub failing to use the linker correctly.

2021-10-22 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 22 October 2021 at 21:21:41 UTC, jfondren wrote: On Friday, 22 October 2021 at 19:56:37 UTC, Ruby The Roobster wrote: I have a simple vibe-d project built with dub. Running the command, dub build --force returns the following output: I'd start by running `dub -v build --force`

Dub failing to use the linker correctly.

2021-10-22 Thread Ruby The Roobster via Digitalmars-d-learn
I have a simple vibe-d project built with dub. Running the command, dub build --force returns the following output: Performing "debug" build using E:\Programs\D\dmd2\windows\bin\dmd.exe for x86_64. mir-linux-kernel 1.0.1: building configuration "library"... taggedalgebraic 0.11.22: building

Linker error

2021-10-11 Thread Ruby The Roobster via Digitalmars-d-learn
So, I have the following two files: skeleton.d: ```d /*skeleton.d by Ruby The Roobster*/ /*Version 1.0 Release*/ /*Module for representing skeletons in the D Programming Language 2.0*/ /*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General

Re: foreach(ubyte j;0 .. num) is bugging out

2021-09-22 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 23 September 2021 at 00:17:49 UTC, jfondren wrote: On Thursday, 23 September 2021 at 00:06:42 UTC, Ruby The Roobster wrote: So, I have the following function: ```d writeln(tempcolor); //For this matter, the program correctly reports tempcolor as 1... for(ubyte j = 0;j <

foreach(ubyte j;0 .. num) is bugging out

2021-09-22 Thread Ruby The Roobster via Digitalmars-d-learn
So, I have the following function: ```d public Sprite ReadSpriteFromFile(immutable(char)[] filename) { //Reads a sprite in my made up .spr format(trash, why does this even exist) ubyte[] ftext; Color[] colors; Point[][] points;

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-21 Thread Ruby The Roobster via Digitalmars-d-learn
On Saturday, 21 August 2021 at 06:08:17 UTC, evilrat wrote: First parameter for CreateWindow should be window class string that you used in wndclass.lpszClassName = appName.toUTF16z; Fix: wndclass.lpszClassName = "Test"; //May need casting...

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-21 Thread Ruby The Roobster via Digitalmars-d-learn
On Saturday, 21 August 2021 at 23:50:08 UTC, Ruby The Roobster wrote: On Saturday, 21 August 2021 at 06:08:17 UTC, evilrat wrote: First parameter for CreateWindow should be window class string that you used in wndclass.lpszClassName = appName.toUTF16z; Fix: wndclass.lpszClassName = "Test";

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-20 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 20 August 2021 at 05:22:20 UTC, nov wrote: On Friday, 20 August 2021 at 04:27:34 UTC, Jesse Phillips wrote: For me, this code generates the Message Box. Does this happen for you? no errors https://run.dlang.io/is/4tlm3p ```D void main() { try { import std.stdio: File;

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-19 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 19 August 2021 at 03:25:31 UTC, Jesse Phillips wrote: tell me what went wrong. I am using DMD 2.097.2 This is an error message you'll get from Windows if the file is locked (open by another application). Odd. This works if I use a console application. It also works if I use C

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-18 Thread Ruby The Roobster via Digitalmars-d-learn
On Wednesday, 18 August 2021 at 17:54:47 UTC, Paul Backus wrote: On Wednesday, 18 August 2021 at 17:42:53 UTC, Ruby The Roobster wrote: Output(Given to me by a message box that display's Throwable.msg in it's body): Access Violation Is this a bug, or me being stupid? If it's the

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-18 Thread Ruby The Roobster via Digitalmars-d-learn
On Wednesday, 18 August 2021 at 17:54:47 UTC, Paul Backus wrote: On Wednesday, 18 August 2021 at 17:42:53 UTC, Ruby The Roobster wrote: Output(Given to me by a message box that display's Throwable.msg in it's body): Access Violation Is this a bug, or me being stupid? If it's the

std.stdio.File is throwing with the message of: "Access Violation"

2021-08-18 Thread Ruby The Roobster via Digitalmars-d-learn
All I did was try to access a file with a self-made library. It didn't work. I tried again directly from the main file. This is the code: ```d File file = File("E:\\Users\\User\\Desktop\\dutils\\test.spr","r"); //This file exists on my system, so it should work... file.close();

Re: Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-13 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 13 August 2021 at 21:10:38 UTC, Steven Schveighoffer wrote: On 8/13/21 3:59 PM, Mike Parker wrote: On Friday, 13 August 2021 at 16:18:06 UTC, Ruby The Roobster wrote: ... ... ... Well, subtracting the length doesn't do much, you aren't actually accessing the array block, you

Re: Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-13 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 13 August 2021 at 19:59:46 UTC, Mike Parker wrote: You aren't supposed to be manipulating GC-managed memory via class destructors. You can not rely on that memory being valid at the time that it's accessed in the destructor---the object may already have been destroyed.

Re: Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-13 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 13 August 2021 at 03:05:22 UTC, Mike Parker wrote: On Friday, 13 August 2021 at 00:30:59 UTC, Ruby The Roobster wrote: When I run the program and close the window, the program still runs in background mode. I don't know why this happens nor how to fix it. Does anybody know

Re: Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-13 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 13 August 2021 at 03:05:22 UTC, Mike Parker wrote: On Friday, 13 August 2021 at 00:30:59 UTC, Ruby The Roobster wrote: When I run the program and close the window, the program still runs in background mode. I don't know why this happens nor how to fix it. Does anybody know

Re: Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-13 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 13 August 2021 at 03:05:22 UTC, Mike Parker wrote: On Friday, 13 August 2021 at 00:30:59 UTC, Ruby The Roobster wrote: When I run the program and close the window, the program still runs in background mode. I don't know why this happens nor how to fix it. Does anybody know

Help with Win32: PostQuitMessage(0) doesn't post WM_QUIT apparently, because the message loop is not exited.

2021-08-12 Thread Ruby The Roobster via Digitalmars-d-learn
Here is the message loop: ```d while(GetMessage(, hwnd,0,0)) { if(msg.message == WM_QUIT) break; TranslateMessage(); DispatchMessage(); } ``` The WndProc(LRESULT CALLBACK): ```d extern(Windows) LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) nothrow {

Re: Range Error

2021-04-12 Thread Ruby The Roobster via Digitalmars-d-learn
On Monday, 12 April 2021 at 01:22:12 UTC, Steven Schveighoffer wrote: On 4/11/21 4:41 PM, Bastiaan Veelo wrote: On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line:

Re: Range Error

2021-04-12 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 11 April 2021 at 20:41:35 UTC, Bastiaan Veelo wrote: On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on

Re: Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Nevermind. I messed up what line it was. It was actually this line: ```d square[i][j] = new Square(Color.none, sColor.white); ```

Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
So, here is the full code: ```d enum Color {none=0,red=1,black=2}; enum sColor {black=0,white=1}; class Square { public: this(Color color, sColor Scolor) { this.color = color; this.Scolor = Scolor; } Color color; sColor Scolor; } import std.stdio; void

  1   2   >