Re: Designated initializers to function argument

2023-07-28 Thread Mike Parker via Digitalmars-d-learn
On Friday, 28 July 2023 at 21:07:47 UTC, bachmeier wrote: On Friday, 28 July 2023 at 17:07:37 UTC, IchorDev wrote: No shit, it felt like an eternity. But it's still not in the spec...? I'd expect it to appear in the spec after there's a real release. This is the first I've heard of it bei

Re: AA vs __gshared

2023-07-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/28/23 11:15 AM, IchorDev wrote: 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]" !! It seems like it's not __

Re: Designated initializers to function argument

2023-07-28 Thread bachmeier via Digitalmars-d-learn
On Friday, 28 July 2023 at 17:07:37 UTC, IchorDev wrote: 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

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 th

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 screen

Thread/Task cancellation

2023-07-28 Thread Gjiergji via Digitalmars-d-learn
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 long running thread looks like this (in C#): ```csharp tr

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: Designated initializers to function argument

2023-07-28 Thread bachmeier via Digitalmars-d-learn
On Friday, 28 July 2023 at 07:35:00 UTC, IchorDev wrote: 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 defau

Re: Perspective Projection

2023-07-28 Thread Dennis via Digitalmars-d-learn
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 screen. How do you pass the matrix to OpenGL? Be careful tha

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); view.make

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: Syntax for Static Import of User Define Attributes

2023-07-28 Thread ryuukk_ via Digitalmars-d-learn
Whenever there might be symbol clash, or when i want to make sure i can identify where something from from i do: ```d import me = my.awesome.module; void main() { me.hi(); } ```

Re: AA vs __gshared

2023-07-28 Thread Kagamin via Digitalmars-d-learn
Your error is using allocating the object with malloc. Since gc doesn't see your AA, the AA is freed and you get UAF.

Re: Syntax for Static Import of User Define Attributes

2023-07-28 Thread Dennis via Digitalmars-d-learn
On Friday, 28 July 2023 at 12:20:05 UTC, Steven Schveighoffer wrote: On 7/28/23 8:10 AM, Vijay Nayar wrote: It might be possible to expand the grammar. It seems very specific to UDAs, as it doesn't just throw out `Expression` or whatnot. It probably has to do with the spot that it's in (declar

Re: Syntax for Static Import of User Define Attributes

2023-07-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/28/23 8:10 AM, Vijay Nayar wrote: However, this makes me wonder. Is there any reason why the `@` shouldn't recognize the dots in a fully-qualified-name on its own, without the need for parentheses? It might be possible to expand the grammar. It seems very specific to UDAs, as it doesn't

Re: Syntax for Static Import of User Define Attributes

2023-07-28 Thread Vijay Nayar via Digitalmars-d-learn
On Friday, 28 July 2023 at 11:54:12 UTC, Steven Schveighoffer wrote: On 7/28/23 4:15 AM, Vijay Nayar wrote: I tried it and it worked for me. The template-argument syntax is normal. It's just a list of types or expressions (i.e. not a function argument list) What is the error? -Steve You'r

Re: Syntax for Static Import of User Define Attributes

2023-07-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/28/23 4:15 AM, Vijay Nayar wrote: On Thursday, 27 July 2023 at 21:24:44 UTC, Dennis wrote: On Thursday, 27 July 2023 at 21:19:08 UTC, Vijay Nayar wrote: Attempted Fix 2: Enclose the entire attribute name in parenthesis. ``` static import vibe.data.serialization; class ChatCompletionFuncti

Re: Designated initializers to function argument

2023-07-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/28/23 3:35 AM, IchorDev wrote: 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: strok

Re: AA vs __gshared

2023-07-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/28/23 4:39 AM, IchorDev wrote: Issue is, this code I posted actually runs just fine, unlike the real code. My actual code does this HIGHLY SUSPICIOUS thing when printing their length each time before using them: ``` 766 766 765 766 767 768 768 768 768 768 768 768 768 768 768 768 768 768 7

openssl 1.1 vs. 3.0 for vibe.d:tls on Ubuntu 22.04

2023-07-28 Thread Guillaume Lathoud via Digitalmars-d-learn
Hello, some context first: I recently updated a server to Ubuntu 22.04 which appears to have only openssl 3.0.2 installed. Dub could compile my project, but could not link it anymore, as the D code seemed to be expecting openssl 1.1 whereas only 3.0.2 was installed. That type of errors: ``` /

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: Syntax for Static Import of User Define Attributes

2023-07-28 Thread Vijay Nayar via Digitalmars-d-learn
On Thursday, 27 July 2023 at 21:24:44 UTC, Dennis wrote: On Thursday, 27 July 2023 at 21:19:08 UTC, Vijay Nayar wrote: Attempted Fix 2: Enclose the entire attribute name in parenthesis. ``` static import vibe.data.serialization; class ChatCompletionFunctions { @(vibe.data.serialization.name)

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