Re: Looking for a simple GUI library that works with Vulkan on SDL2

2025-07-04 Thread IchorDev via Digitalmars-d-learn
On Thursday, 20 February 2025 at 10:05:13 UTC, Danny Arends wrote: Running into some weird linker issues within bindbc.common.codegen: ``` /usr/bin/ld: /home/danny/.dub/cache/betterct/~master/build/betterC-debug-gZx8lRyN8EaQ6hq_UuhHCw/betterct.o:(.data._D39TypeInfo_S6bindbc6common7codegen6FnBi

Re: Looking for a simple GUI library that works with Vulkan on SDL2

2025-02-19 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 19 February 2025 at 15:21:19 UTC, Danny Arends wrote: I've tried several different bindings to IMgui, however, none seem to work and seem abandoned to me (the most recent updated one 'bindbc-imgui' was updated 3 years ago). Actually, I have been working on an update to BindBC-ImG

Re: TLS variable for only one thread

2025-02-19 Thread IchorDev via Digitalmars-d-learn
On Saturday, 15 February 2025 at 10:09:39 UTC, Jonathan M Davis wrote: I think that you need to be clearer about what you're trying to do. If a module-level variable is not shared, __gshared, or immutable, then each thread gets a completely separate variable, and no other thread has access to t

Re: AES in dlang?

2025-02-15 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 12 February 2025 at 00:20:02 UTC, Andy Valencia wrote: I was wondering about an @safe dlang version of AES, and just couldn't find one. (Well, there was one, but without any of the nonce/IV stuff.) I know many will be perfectly happy with calls into C libraries, but for those wh

Re: How to iterate string enum values?

2024-12-28 Thread IchorDev via Digitalmars-d-learn
On Monday, 23 December 2024 at 20:32:58 UTC, Anton Pastukhov wrote: On Monday, 23 December 2024 at 20:26:47 UTC, bauss wrote: Simply cast el to a string instead of using std.conv.to Thanks much, it worked! Though I'm confused why. Could you please elaborate? Well, `to!string` gets a *strin

Re: Hello World in D using Assembly

2024-12-28 Thread IchorDev via Digitalmars-d-learn
On Friday, 27 December 2024 at 20:08:08 UTC, Renato Athaydes wrote: Anyway, I thought this was cool and as I couldn't find anything much about ASM in D, I thought this may be useful to others. The reason is probably that D's regular inline assembly isn't very desirable. It only supports x86 an

Re: Is there a way to Deferred binding symbol from dynamic library?

2024-11-29 Thread IchorDev via Digitalmars-d-learn
On Tuesday, 26 November 2024 at 10:34:07 UTC, Dakota wrote: On Saturday, 23 November 2024 at 12:09:22 UTC, IchorDev wrote: Why not load the libraries at runtime and look the pointers up with symbol names? Or do you really need the compiler to do it for you? Because I need link some part sta

Re: Is there a way to Deferred binding symbol from dynamic library?

2024-11-23 Thread IchorDev via Digitalmars-d-learn
On Friday, 22 November 2024 at 06:13:26 UTC, Dakota wrote: Try build a dynamic library, a lot function symbol and global symbol need to be deferred binding from runtime app. Why not load the libraries at runtime and look the pointers up with symbol names? Or do you really need the compiler to

Re: Using a tuple as a function parameter

2024-11-23 Thread IchorDev via Digitalmars-d-learn
On Friday, 22 November 2024 at 16:36:43 UTC, Andrew wrote: I'm getting started using D for some small personal projects and one thing I wanted to do was use a helper function for a tuple. I declared the function like this: string getOrZeroth(Tuple!(string, string, string) tup, int i) pure

Re: Poor Carlos does not manage to find where to eat

2024-09-22 Thread IchorDev via Digitalmars-d-learn
On Saturday, 21 September 2024 at 05:00:51 UTC, user1234 wrote: On Saturday, 21 September 2024 at 04:29:15 UTC, user1234 wrote: ```d module m; [...] Beside the childish example... D could use a system of "constraint matching score" to help Carlos. Three AndAndExps verified should have a bet

Re: need help to work around float union non-zero init

2024-09-20 Thread IchorDev via Digitalmars-d-learn
On Friday, 20 September 2024 at 09:38:54 UTC, Dakota wrote: I consider this is compiler bug (it may take years to get fixed) I've sent issues for compiler bugs and had them fixed within the next release—about month, not years. Also yes, this seems to be a compiler bug; unless there's some s

Re: Using D libraries with SDL. Error: "Cannot find module protobuf'

2024-08-24 Thread IchorDev via Digitalmars-d-learn
On Saturday, 24 August 2024 at 12:35:03 UTC, Nicol Farran Terra wrote: On Saturday, 24 August 2024 at 12:29:41 UTC, IchorDev wrote: On Saturday, 24 August 2024 at 12:24:04 UTC, Nicol Farran Terra wrote: On Saturday, 24 August 2024 at 12:11:03 UTC, IchorDev wrote: snip snip2 That isvery

Re: Using D libraries with SDL. Error: "Cannot find module protobuf'

2024-08-24 Thread IchorDev via Digitalmars-d-learn
On Saturday, 24 August 2024 at 12:24:04 UTC, Nicol Farran Terra wrote: On Saturday, 24 August 2024 at 12:11:03 UTC, IchorDev wrote: snip Okay, yeah now I see my problem sort of. So now it at least builds, but it wont compile with dmd app.d. Says basically the same thing before where it canno

Re: Using D libraries with SDL. Error: "Cannot find module protobuf'

2024-08-24 Thread IchorDev via Digitalmars-d-learn
On Saturday, 24 August 2024 at 11:34:18 UTC, Nicol Farran Terra wrote: You are importing `google.protobuf`, right? Providing the app.d would be helpful, or at least a snippet of it with the import that’s giving you the ‘error’—presumably a compiler error? No, I am just importing 'protobuf'.

Re: Understanding the Behavior of i + ++i in D Language

2024-08-23 Thread IchorDev via Digitalmars-d-learn
On Friday, 23 August 2024 at 09:49:27 UTC, Nick Treleaven wrote: On Friday, 23 August 2024 at 09:42:38 UTC, Nick Treleaven wrote: C++: undefined, could be `6 + 6` if the increment is done first. g++ gives me a warning with `-Wall`: You asked about C, for some reason I used C++. I think the `

Re: Using D libraries with SDL. Error: "Cannot find module protobuf'

2024-08-23 Thread IchorDev via Digitalmars-d-learn
On Saturday, 24 August 2024 at 00:24:12 UTC, Nicol Farran Terra wrote: I am not sure if this expected behavior, but importing this in my app.d does not work. I get an error about a missing import. You are importing `google.protobuf`, right? Providing the app.d would be helpful, or at least a sn

Re: How to find the right function in the Phobos library?

2024-08-21 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 21 August 2024 at 21:22:44 UTC, Andy Valencia wrote: On Wednesday, 21 August 2024 at 20:45:10 UTC, IchorDev wrote: You should’ve probably considered using the equivalent function from Phobos because it’s a D function so it can be inlined and such: https://dlang.org/library/std/b

Re: Do you have a better way to remove element from a array?

2024-08-21 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 21 August 2024 at 08:00:04 UTC, aberba wrote: On Sunday, 11 August 2024 at 20:57:15 UTC, IchorDev wrote: On Sunday, 11 August 2024 at 06:04:08 UTC, mw wrote: BTW, for associative array, `remove()` is in-place; but here for std.algorithm.mutation.remove (*keyword*: mutation), one

Re: How to find the right function in the Phobos library?

2024-08-21 Thread IchorDev via Digitalmars-d-learn
On Tuesday, 20 August 2024 at 21:53:10 UTC, Andy Valencia wrote: On Saturday, 17 August 2024 at 17:31:53 UTC, Steven Schveighoffer wrote: On Saturday, 17 August 2024 at 05:28:37 UTC, Bruce wrote: What is the best way to search for a function in the Phobos library? Go to dlang.org, select dic

Re: How do you typically debug / write D code (Visual Studio - known to be broken in Error pane etc), VScode - I get this error...

2024-08-19 Thread IchorDev via Digitalmars-d-learn
On Monday, 19 August 2024 at 10:59:33 UTC, Daniel Donnelly, Jr. wrote: So how do you guys efficiently debug D if there exists no working environment or is there a nice IDE I'm unaware of? Use gdb; unless you’re running macOS, in which case use the version of lldb included in the macOS develope

Re: How do you implement complementary "A*(A*A) = A^3" operator overloads (I'm getting strange results)

2024-08-19 Thread IchorDev via Digitalmars-d-learn
On Monday, 19 August 2024 at 09:42:44 UTC, Daniel Donnelly, Jr. wrote: ```d Type opBinary(string op="^")(int k) in { assert (k > 0); } do { if (k == 1) return this; auto P = this; while (k > 0) { k --; P = this * P; }

Re: How to find the right function in the Phobos library?

2024-08-18 Thread IchorDev via Digitalmars-d-learn
On Saturday, 17 August 2024 at 19:49:04 UTC, Vinod K Chandran wrote: All I want is a delay function which simulate some work load in current thread. As Rikki points out, delay or sleep functions (as the name says) ‘put the thread to sleep’. If you want the thread to be constantly busy, you ca

Re: create fixed length string of characters

2024-08-17 Thread IchorDev via Digitalmars-d-learn
On Saturday, 17 August 2024 at 06:03:09 UTC, Bruce wrote: Is there anything wrong with using the char[60] directly? In this case it’s fine to.

Re: create fixed length string of characters

2024-08-16 Thread IchorDev via Digitalmars-d-learn
On Friday, 16 August 2024 at 15:58:31 UTC, Nick Treleaven wrote: On Friday, 16 August 2024 at 13:30:53 UTC, IchorDev wrote: On Friday, 16 August 2024 at 11:37:08 UTC, Nick Treleaven wrote: On Friday, 16 August 2024 at 06:15:18 UTC, Bruce wrote: ```d string s = a.dup; // copy to heap, assuming y

Re: create fixed length string of characters

2024-08-16 Thread IchorDev via Digitalmars-d-learn
On Friday, 16 August 2024 at 11:37:08 UTC, Nick Treleaven wrote: On Friday, 16 August 2024 at 06:15:18 UTC, Bruce wrote: ```d string s = a.dup; // copy to heap, assuming you need the data to escape (use a[] otherwise) s.writeln(); ``` I think you meant `idup`? `dup` will make it mutable.

Re: Why does this mixin fail to compile?

2024-08-13 Thread IchorDev via Digitalmars-d-learn
On Monday, 12 August 2024 at 15:23:31 UTC, Stefan Koch wrote: It's about 12.000 lines of code. I am not sure how much has rotted away, I last touched it in 2021. The relevant files would be: the bytecode interpreter: https://github.com/UplinkCoder/dmd/blob/newCTFE_2093/src/dmd/ctfe/bc.d the vi

Re: Why does this mixin fail to compile?

2024-08-12 Thread IchorDev via Digitalmars-d-learn
On Tuesday, 2 July 2024 at 16:46:11 UTC, Jonathan M Davis wrote: On Tuesday, July 2, 2024 1:23:42 AM MDT ryuukk_ via Digitalmars-d-learn wrote: I said it 2 times already, i don't want string concatenation, i'll benchmark later, but not right now, right now i'm looking for a functioning code wit

Re: Do you have a better way to remove element from a array?

2024-08-11 Thread IchorDev via Digitalmars-d-learn
On Sunday, 11 August 2024 at 06:04:08 UTC, mw wrote: ``` array = array.remove(index); // return a new container ``` I was looking through Phobos to find what might be an appropriate replacement for `remove`. I read `remove`’s documentation, and there it says it removes the element in-place

Re: Do you have a better way to remove element from a array?

2024-08-11 Thread IchorDev via Digitalmars-d-learn
On Sunday, 11 August 2024 at 06:04:08 UTC, mw wrote: BTW, for associative array, `remove()` is in-place; but here for std.algorithm.mutation.remove (*keyword*: mutation), one need to do ``` array = array.remove(index); // return a new container // v.s. aa.remove(key); // return bool (

Re: Recommendations on porting Python to D

2024-08-10 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote: is anyone aware of any tools that generate an abstract syntax tree which could then be converted to somewhat equivalent D code? Just keep in mind that dependence on such a method might cause you to overlook potential higher level

Re: Event struct via registers

2024-08-10 Thread IchorDev via Digitalmars-d-learn
On Saturday, 10 August 2024 at 07:46:46 UTC, Vitaliy Fadeev wrote: ## Trouble 1 Pass the structure through registers ? ## Trouble 2 Wrap the registries in a structure ? ## Use case I need to pass different events: `Draw_Event`, `Mouse_Move_Event`, `...` I need to pass an event to many objec

Re: Named template arguments

2024-08-08 Thread IchorDev via Digitalmars-d-learn
On Thursday, 8 August 2024 at 10:45:54 UTC, Anonymouse wrote: Is there a reason why we can't have named template arguments too? I don't particularly mind it if we'd have to limit the ordering so that variadics have to be placed last. I just want to avoid having to resort to `Flag!"bar" bar` par

Re: D feature request

2024-08-06 Thread IchorDev via Digitalmars-d-learn
On Monday, 5 August 2024 at 12:25:48 UTC, user1234 wrote: On Monday, 5 August 2024 at 03:09:41 UTC, IchorDev wrote: Also sometimes if a feature is very minor you can submit a ‘feature request’ issue. "enhancement" is the bugzilla word for this. IIRC it's in the "severity" field. Yes, precis

Re: D feature request

2024-08-04 Thread IchorDev via Digitalmars-d-learn
On Sunday, 4 August 2024 at 10:32:38 UTC, Richard (Rikki) Andrew Cattermole wrote: Chuck it into the ideas forum. If it interests somebody, somebody else can work on it. Also sometimes if a feature is very minor you can submit a ‘feature request’ issue.

Re: Segmentation fault while reading a file

2024-08-01 Thread IchorDev via Digitalmars-d-learn
On Thursday, 1 August 2024 at 14:42:36 UTC, Ruby The Roobster wrote: Thank you. I am not very well acquainted with the standard library, and this cleans up things significantly. Question: Is there a good guide to Phobos anywhere? I would like to learn the more commonly used algorithms / con

Re: Any way to automatically convert structs on return?

2024-08-01 Thread IchorDev via Digitalmars-d-learn
On Thursday, 1 August 2024 at 14:20:29 UTC, user1234 wrote: That was a general criticism of implicit construction. We are only talking about it in the context of returning from a function. The classic example is ```d struct S {int i;} function f(S s); function f(int i); unittest { f(0); }

Re: Any way to automatically convert structs on return?

2024-08-01 Thread IchorDev via Digitalmars-d-learn
On Thursday, 1 August 2024 at 09:55:08 UTC, user1234 wrote: The problem would be that sorting the candidates of an overload set would be more complicated. Also in certain cases it would be less obvious to get which one is selected. Please elaborate about how this would interact with function

Re: Any way to automatically convert structs on return?

2024-08-01 Thread IchorDev via Digitalmars-d-learn
On Thursday, 1 August 2024 at 07:25:53 UTC, Emma wrote: This code works: ```d struct None {} struct Option(T) { bool hasSome; T value; this(None) {} this(T v) { hasSome = true; value = v; } } Option!int a = 123;// automatically constructs an Option!in

Re: Segmentation fault while reading a file

2024-08-01 Thread IchorDev via Digitalmars-d-learn
Hey just a heads up, you might wanna use [`readText`](https://dlang.org/library/std/file/read_text.html) and [`lineSplitter`](https://dlang.org/library/std/string/line_splitter.html) just so you don’t have to deal with file handles. Also you can use something like [`formattedRead`](https://dlang

Re: Libraries for Model Loading

2024-07-26 Thread IchorDev via Digitalmars-d-learn
On Thursday, 18 July 2024 at 14:02:09 UTC, Ruby The Roobster wrote: Is there a good package available that can load models, Wavefront .obj files in particular? I tried to use the existing bindings to old versions of Assimp, but I could not get Assimp itself to build on my machine. Thanks in

Re: Prevent self-comparison without taking the address

2024-07-25 Thread IchorDev via Digitalmars-d-learn
On Thursday, 25 July 2024 at 14:05:50 UTC, Dom DiSc wrote: As he said: no. It's only true for @safe: No they did not, they specifically said that my assertion holds true for all other [function attributes](https://dlang.org/spec/attribute.html#function-attributes). This does not tell me anyth

Re: Prevent self-comparison without taking the address

2024-07-25 Thread IchorDev via Digitalmars-d-learn
On Thursday, 25 July 2024 at 13:01:53 UTC, Dennis wrote: That's true for the other function attributes, but `@safe:` actually does penetrate scopes The spec doesn’t mention this at all! Is this the case for any other `AttributeSpecifier` declarations?

Re: Prevent self-comparison without taking the address

2024-07-25 Thread IchorDev via Digitalmars-d-learn
On Thursday, 25 July 2024 at 10:50:04 UTC, Dom DiSc wrote: ```d @safe: struct S{ ``` Also just so you know, placing `@safe:` there will not affect the contents of `S`. It has to be inside the struct declaration to affect its contents.

Re: Prevent self-comparison without taking the address

2024-07-25 Thread IchorDev via Digitalmars-d-learn
On Thursday, 25 July 2024 at 10:50:04 UTC, Dom DiSc wrote: Can I replace this pattern with ```(x is this)``` or are there some special cases where this doen't work? When a parameter is `ref` it is treated as a value type (i.e. it has value semantics), even though it is a reference; therefore a

Re: Array concatenation & optimisation

2024-07-22 Thread IchorDev via Digitalmars-d-learn
On Monday, 22 July 2024 at 12:03:33 UTC, Quirin Schroll wrote: this has no effect on whether the function is `@nogc`. That is a highly amusing (but obviously understandable) logical contradiction that I’d never considered before. ‘Sometimes you can’t use non-GC code in `@nogc` code.’

Re: Array concatenation & optimisation

2024-07-21 Thread IchorDev via Digitalmars-d-learn
On Sunday, 21 July 2024 at 15:41:50 UTC, Johan wrote: https://d.godbolt.org/z/sG5Kancs4 The short array is not dynamically allocated (it's allocated on the stack, or for larger arrays it will be a hidden symbol in the binary image), even at `-O0` (i.e. `-O` was not passed). Wow thanks, that'

Re: Array concatenation & optimisation

2024-07-21 Thread IchorDev via Digitalmars-d-learn
On Sunday, 21 July 2024 at 10:33:38 UTC, Nick Treleaven wrote: Just to mention that if you assign to the static array it works: `a = [1,3,6,9];`. Bonkers. `array[]` is meant to be 'all of `array` as a slice', so you'd think that's how you copy a slice to a static array, but no! My understand

Array concatenation & optimisation

2024-07-20 Thread IchorDev via Digitalmars-d-learn
Obviously when writing optimised code it is desirable to reduce heap allocation frequency. With that in mind, I'm used to being told by the compiler that I can't do this in `@nogc` code: ```d void assign(ref int[4] a) @nogc{ a[] = [1,3,6,9]; //Error: array literal in `@nogc` function `assign`

Re: Tuple deconstruction in Phobos

2024-07-20 Thread IchorDev via Digitalmars-d-learn
On Saturday, 20 July 2024 at 20:48:29 UTC, Nick Treleaven wrote: Instead of the `tie` assignment, you can just do: ```d import std.meta; AliasSeq!(y, x) = tupRetFn().expand; ``` And here I was trying to use comma expressions for this like a buffoon! Of course they didn't work,

Tuple deconstruction in Phobos

2024-07-20 Thread IchorDev via Digitalmars-d-learn
Why does Phobos not provide a method to easily deconstruct tuples? Here's a trivial implementation: ```d //Similar to C++'s `std::tie`. Can anyone tell me why it's called `tie`? void tie(T...)(typeof(T) src){ static foreach(ind, i; src){ T[ind] = i; } } //Usage

Re: How to add a character literal to a string without ~ operator?

2024-04-08 Thread IchorDev via Digitalmars-d-learn
On Thursday, 4 April 2024 at 18:14:54 UTC, BoQsc wrote: I'm looking for more readable standard function to add a **character** literal to a **string**. Concatenate is the verb you're looking for, not add. 'Adding' a `char` to a `string` sounds like you want `myString[] += myChar;`, which woul

Re: How to resolve two packages requiring different versions of another package?

2024-04-05 Thread IchorDev via Digitalmars-d-learn
On Thursday, 4 April 2024 at 14:29:56 UTC, WhatMeWorry wrote: Error: Unresolvable dependencies to package bindbc-loader: bindbc-opengl 0.13.0 depends on bindbc-loader ~>0.3.0 bindbc-sdl 1.4.7 depends on bindbc-loader ~>1.1.0 Please update `bindbc-opengl` to `1.1.0`. I think it's backwar

Re: D: How would one make a shared dynamically linked D library?

2023-11-09 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 8 November 2023 at 11:48:58 UTC, BoQsc wrote: I would like to export some functionality as external shared dynamically linked D library. Is it possible to do that in D Language Yes, as long as the symbols you want to use externally are `public`, which is the default. When it co

Re: Type constraint

2023-10-08 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 4 October 2023 at 01:46:42 UTC, Joel wrote: I think the if without static is still static, since it's part of the function name part, or so (outside of the curly bracket scope). You can't have regular if-statements inside templates. Regular if-statements are checked at runtime b

Re: Define a new custom operator in D Language.

2023-10-08 Thread IchorDev via Digitalmars-d-learn
On Monday, 2 October 2023 at 21:37:56 UTC, bachmeier wrote: On Monday, 2 October 2023 at 19:28:32 UTC, BoQsc wrote: I'm unable to see how the operator overloading would allow to define a new custom operator. And I don't expect that to change. This has come up many times. With a parameter th

Re: AA vs __gshared

2023-08-15 Thread IchorDev via Digitalmars-d-learn
On Tuesday, 15 August 2023 at 17:36:13 UTC, Steven Schveighoffer wrote: On 8/12/23 5:55 AM, IchorDev wrote: On Thursday, 10 August 2023 at 15:20:28 UTC, Steven Schveighoffer wrote: That shouldn't matter. Well, it does here. The AA is mutated during the loop, so perhaps this is an optimisatio

Re: std.experimental.allocator

2023-08-14 Thread IchorDev via Digitalmars-d-learn
On Sunday, 13 August 2023 at 16:00:51 UTC, Richard (Rikki) Andrew Cattermole wrote: Yeah you're right Ternary should probably be replaced, although amazingly it has never caused problems so far. But I cannot agree about RAII. Its a valid tool for managing lifetimes of memory allocators. Memory

std.experimental.allocator

2023-08-13 Thread IchorDev via Digitalmars-d-learn
I feel like I can't possibly be the first to ask, but I couldn't find any prior discussion of this: When is `std.experimental.allocator` going to be moved out of `experimental`? Is there any roadmap for it? Is it just in limbo?

Re: Designated initializers to function argument

2023-07-28 Thread IchorDev via Digitalmars-d-learn
On Friday, 28 July 2023 at 17:04:33 UTC, bachmeier wrote: [The DIP](https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1030.md) was approved long ago. It was waiting for an implementation. No shit, it felt like an eternity. But it's still not in the spec...?

Re: AA vs __gshared

2023-07-28 Thread IchorDev via Digitalmars-d-learn
On Friday, 28 July 2023 at 11:15:31 UTC, Steven Schveighoffer wrote: All `__gshared` does is give you storage that is accessible from all threads, "All __gshared does is give you [a live bomb, ready to go off at any moment]" !! On Friday, 28 July 2023 at 14:10:16 UTC, Kagamin wrote: Your err

Re: AA vs __gshared

2023-07-28 Thread IchorDev via Digitalmars-d-learn
On Thursday, 27 July 2023 at 21:31:02 UTC, Jonathan M Davis wrote: What should normally be happening is that you use shared, and then when you've protected the object so that you know that it can only be accessed on the current thread by the section of code that you're in (e.g. by locking a mut

Re: Designated initializers to function argument

2023-07-28 Thread IchorDev via Digitalmars-d-learn
On Tuesday, 11 July 2023 at 17:43:43 UTC, Steven Schveighoffer wrote: On 7/11/23 11:22 AM, Ki Rill wrote: On Tuesday, 11 July 2023 at 15:16:54 UTC, Ki Rill wrote: apply(Appearance(color: BLACK, strokeWidth: 4)); // other fields are default initialized: strokeOpacity, fillOpacity, Yes, I was g

Re: AA vs __gshared

2023-07-28 Thread IchorDev via Digitalmars-d-learn
On Friday, 28 July 2023 at 04:13:13 UTC, Kagamin wrote: The difference between them is purely formal if you're not on an old gdc, where shared was synchronized like C# volatile. I'm not sure that's correct. Also I always use the latest compiler versions where possible. start many threads an

Re: AA vs __gshared

2023-07-27 Thread IchorDev via Digitalmars-d-learn
On Thursday, 27 July 2023 at 21:31:02 UTC, Jonathan M Davis wrote: Now, as to what's happening in your code that's causing segfaults, the most likely culprit would be that you're accessing the AA without actually having done anything to prevent other threads from accessing it at the same time

Re: Getting __COLUMN__ of source code location.

2023-07-27 Thread IchorDev via Digitalmars-d-learn
I'm not aware of any way to do that exact thing. Measuring what column a line is on would be quite subjective. How wide is a tab space? Technically, it could be any number of columns depending on the display configuration used. On Sunday, 23 July 2023 at 15:01:51 UTC, realhet wrote: Why is th

AA vs __gshared

2023-07-27 Thread IchorDev via Digitalmars-d-learn
I've been getting a lot of segfaults from using associative arrays recently. The faults happen seemingly at random, and from pretty mundane stuff like `if(auto x = y in z)` that run very often: ``` Segmentation fault. #0 0x55670f4a in rt.aaA.Impl.findSlotLookup(ulong, scope const(void

Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread IchorDev via Digitalmars-d-learn
On Monday, 24 July 2023 at 13:30:27 UTC, cc wrote: Is there any list of known significant "gotchas" with moving to LDC from DMD? Any unexpected surprises to watch out for or be careful for? I'm thinking of all the "features" of DMD that are now considered verboten by many users (e.g. compil

Re: Garbage Collectors

2023-07-19 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 19 July 2023 at 11:27:14 UTC, Richard (Rikki) Andrew Cattermole wrote: druntime supports registering of GC's not compiled with druntime. But because some of the machinery isn't available to you, you would have to recreate it. Oh right, so it's more of a matter of making GC-re

Re: Garbage Collectors

2023-07-19 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 19 July 2023 at 10:50:07 UTC, Richard (Rikki) Andrew Cattermole wrote: Copying out the conservative GC, register it under a different name and getting that to compile and link without recompiling druntime would be a good place to begin without having to understand how GC's work.

Re: Garbage Collectors

2023-07-19 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 19 July 2023 at 08:27:18 UTC, Richard (Rikki) Andrew Cattermole wrote: Its not as simple as porting to the API unfortunately. We don't have barriers of any kind, so that removes most GC designs you would want to use today. We are very close to maxing out what we can do as a resul

Re: getOverloads order

2023-07-13 Thread IchorDev via Digitalmars-d-learn
On Thursday, 13 July 2023 at 10:53:49 UTC, Dennis wrote: On Thursday, 13 July 2023 at 08:03:02 UTC, IchorDev wrote: I've noticed that `__traits(getOverloads)` always returns the overloads in lexical order across DMD, LDC, and GDC. Is this reliable at all? No. It depends on the order the compi

getOverloads order

2023-07-13 Thread IchorDev via Digitalmars-d-learn
I've noticed that `__traits(getOverloads)` always returns the overloads in lexical order across DMD, LDC, and GDC. Is this reliable at all?

Re: Pre-expanding alloc cell(s) / reserving space for an associative array

2023-07-10 Thread IchorDev via Digitalmars-d-learn
On Sunday, 9 July 2023 at 20:24:24 UTC, Cecil Ward wrote: Before I posted a question about avoiding unnecessary allocs/reallocs when adding entries to an array like so uint[ dstring ] arr; when I build it up from nothing with successive insertions. The array is accessed by a key that is a

Re: Weird template instantiation speed?

2023-07-09 Thread IchorDev via Digitalmars-d-learn
On Sunday, 9 July 2023 at 14:49:39 UTC, Steven Schveighoffer wrote: This is probably a bug somewhere, 4 seconds is too much. A reduced test case would be helpful. But I wanted to note, inside a struct template, the template name (by itself) is equivalent to the current instantiation. So jus

Re: Warning The package will no longer be detected starting from v1.42.0

2023-07-09 Thread IchorDev via Digitalmars-d-learn
On Monday, 26 June 2023 at 01:35:07 UTC, Soulsbane wrote: Yeah, each folder under libs is a package and it's own git repository. I think I'll just use the add-local approach. Kind of a pain but getting spammed with a page of warnings every compile is getting tiring :). Thanks a lot for the he

Weird template instantiation speed?

2023-07-09 Thread IchorDev via Digitalmars-d-learn
While working on some new bindings, I've discovered that if `opAssign` in a struct template "`BindingTempl(T)`" has the return type "`BindingTempl!T` then it adds about 4 seconds to the compile time per instantiation of `BindingTempl`. The added compile time is much lower if a function other th

Re: `static` on module-level functions

2023-07-09 Thread IchorDev via Digitalmars-d-learn
On Friday, 7 July 2023 at 13:31:59 UTC, Steven Schveighoffer wrote: D allows no-op attributes in many cases because you can possibly apply attributes to a group via `attribute:` or `attribute { ... }`, and you may not want to fine-tune which things can get the attribute to avoid errors. Her

Re: `static` on module-level functions

2023-07-07 Thread IchorDev via Digitalmars-d-learn
On Friday, 7 July 2023 at 10:01:41 UTC, Richard (Rikki) Andrew Cattermole wrote: Static does do something on functions when they are not free-functions. https://dlang.org/spec/attribute.html#static Well yes, I even mentioned that in the OP. It's just that I'd expect using `static` "incorrec

Re: `static` on module-level functions

2023-07-07 Thread IchorDev via Digitalmars-d-learn
On Friday, 7 July 2023 at 03:18:53 UTC, Richard (Rikki) Andrew Cattermole wrote: Yes, static on a free-function does not do anything. Good to know. I think the D spec should definitely be amended to explicitly mention that static *can* be applied to them, but doesn't do anything.

`static` on module-level functions

2023-07-06 Thread IchorDev via Digitalmars-d-learn
Can anyone point me to a part of the D spec that says what `static` means when applied to functions that are declared at module scope? (Other than module constructors, obviously) I used to assume the property would do something, so I actually used it in a lot of my code when I was first learning

Re: Options for Cross-Platform 3D Game Development

2023-07-05 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 5 July 2023 at 22:27:46 UTC, Andrew wrote: So, I've gotten the itch to have a go at game development in D, after doing a bit of it in Java last year. I've previously used LWJGL, which is a java wrapper for OpenGL, OpenAL, GLFW, and some other useful libs. The problem is, apparen

Re: Strange behaviour of __traits(allMembers)

2023-07-05 Thread IchorDev via Digitalmars-d-learn
On Wednesday, 28 June 2023 at 10:20:44 UTC, Dennis wrote: It's now fixed: https://github.com/dlang/dmd/pull/15335 Yesss! You're a hero indeed!

Re: Strange behaviour of __traits(allMembers)

2023-06-18 Thread IchorDev via Digitalmars-d-learn
On Sunday, 18 June 2023 at 10:04:14 UTC, FeepingCreature wrote: On Sunday, 18 June 2023 at 09:48:40 UTC, IchorDev wrote: Does anyone understand why this happens? Is there any way to subvert this behaviour, or is it actually a bug? Yes, see also my bug report, https://issues.dlang.org/show_bu

Strange behaviour of __traits(allMembers)

2023-06-18 Thread IchorDev via Digitalmars-d-learn
`source/mod/submod.d:` ```d module mod.submod; enum T1{ x } ``` `source/mod/package.d`: ```d module mod; import mod.submod; enum T2{ y } enum T3{ z } static foreach(member; __traits(allMembers, mod)){ pragma(msg, member); } /**Prints: object T1 **/ ``` I get the members of `mod.submod` instea

Re: Returning a reference to be manipulated

2023-04-13 Thread IchorDev via Digitalmars-d-learn
On Thursday, 13 April 2023 at 07:05:10 UTC, Chris Katko wrote: I'm trying to figure out how to return a reference to something that may not be a reference type. ```D struct stats { float[string] data=0; float ref opIndex(string key) { return data[key]; // want a ref to a specific element

SO_PRIORITY

2023-04-11 Thread IchorDev via Digitalmars-d-learn
`std.socket` is missing a `SocketOption`-equivalent to `SO_PRIORITY`. Is this an intentional omission (and if so, why?), or should I try to submit a PR to add it?

Re: dub.sdl bindbc-glfw is returning a deprecation warming. So what do I do now?

2023-03-08 Thread IchorDev via Digitalmars-d-learn
On Thursday, 9 March 2023 at 00:21:02 UTC, WhatMeWorry wrote: my small dub.sdl project uses: dependency "bindbc-glfw" version="~>1.0.1" versions "GLFW_33" and returns Building bindbc-glfw 1.0.1: building configuration [dynamic] C:\Users\Admin\AppData\Local\dub\packages\bindbc-glfw-1.0.1\b

Re: Does D actually support flexible array members?

2022-09-06 Thread IchorDev via Digitalmars-d-learn
On Thursday, 18 August 2022 at 11:25:22 UTC, Paul Backus wrote: I think the closest way to approximate this in D is to use a zero-length static array: ```d struct ArenaChunk { size_t size; ArenaChunk* next; char[0] memory; } ``` Would Nullable be a good option as well? [https:/

Re: BetterC stack traces?

2022-09-06 Thread IchorDev via Digitalmars-d-learn
On Monday, 5 September 2022 at 12:35:10 UTC, Paul Backus wrote: Digging in a little deeper, it looks like the druntime implementation ultimately depends on the C++ exception handling ABI, via its platform-independent library interface. Bindings are defined in `core.internal.backtrace.unwind`

Re: BetterC stack traces?

2022-09-05 Thread IchorDev via Digitalmars-d-learn
On Sunday, 4 September 2022 at 18:49:37 UTC, Paul Backus wrote: You can use `libunwind` for this: https://www.nongnu.org/libunwind/ It's a C library, but it should work for D too. Ah, I'm actually trying to create my own implementation of this, so the goal would be to not rely on a dependenc

BetterC stack traces?

2022-09-04 Thread IchorDev via Digitalmars-d-learn
I'm trying to implement a custom exception system in BetterC. Does anyone know how I'd go about getting a stack trace so that I can print it to stdout? :) I was thinking of utilising UDAs & `__LINE__` but it turns out that UDAs don't let you inject code, which is a shame!