Re: Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 15 November 2021 at 15:56:57 UTC, WebFreak001 wrote: is this currently possible or maybe possible with DIP1000? Yes it is. But besides `-dip1000` and `@safe`, it requires the use of a pointer: ```D @safe: struct ByChunk { FileReader* r; void popFront() {} } struct

Re: Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Nov 15, 2021 at 03:56:57PM +, WebFreak001 via Digitalmars-d-learn wrote: > I have an API with some struct like a file reader. I want to add > byChunks-like functionality to it, so I'm trying to implement it with > a helper struct that implements opApply. I have disabled copying the >

Re: Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/15/21 10:56 AM, WebFreak001 wrote: I have an API with some struct like a file reader. I want to add byChunks-like functionality to it, so I'm trying to implement it with a helper struct that implements opApply. I have disabled copying the file reader struct because it cleans up the

Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread WebFreak001 via Digitalmars-d-learn
I have an API with some struct like a file reader. I want to add byChunks-like functionality to it, so I'm trying to implement it with a helper struct that implements opApply. I have disabled copying the file reader struct because it cleans up the resources once it goes out of scope, however

Re: How to deploy single exe application (?)

2021-11-15 Thread Imperatorn via Digitalmars-d-learn
On Monday, 15 November 2021 at 22:28:41 UTC, russhy wrote: On Monday, 15 November 2021 at 21:16:14 UTC, Willem wrote: Using D -- I have created a simple command line utility that download some info via a https API and save it in a sqlite3 database file. To use the exe on another windows

Re: Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 15 November 2021 at 19:24:56 UTC, Sebastiaan Koppe wrote: On Monday, 15 November 2021 at 15:56:57 UTC, WebFreak001 wrote: is this currently possible or maybe possible with DIP1000? Yes it is. But besides `-dip1000` and `@safe`, it requires the use of a pointer: ```D @safe:

Re: Exceptions names list

2021-11-15 Thread Ali Çehreli via Digitalmars-d-learn
On 11/15/21 2:28 PM, pascal111 wrote: > I want to know where the list of exceptions names that "throw" statement > uses. Such a list is not very useful. Normally all we need is Exception and occasionally one or two other specific types. There can be hundreds of specific types of Exception a

Re: Exceptions names list

2021-11-15 Thread Imperatorn via Digitalmars-d-learn
On Monday, 15 November 2021 at 22:55:55 UTC, pascal111 wrote: On Monday, 15 November 2021 at 22:39:36 UTC, Imperatorn wrote: On Monday, 15 November 2021 at 22:28:28 UTC, pascal111 wrote: I want to know where the list of exceptions names that "throw" statement uses. I searched in dlang site,

Re: Exceptions names list

2021-11-15 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 00:05:45 UTC, Imperatorn wrote: On Tuesday, 16 November 2021 at 00:03:14 UTC, Imperatorn wrote: On Monday, 15 November 2021 at 22:55:55 UTC, pascal111 wrote: On Monday, 15 November 2021 at 22:39:36 UTC, Imperatorn wrote: On Monday, 15 November 2021 at 22:28:28

Re: Completing C code with D style

2021-11-15 Thread pascal111 via Digitalmars-d-learn
On Sunday, 14 November 2021 at 04:29:53 UTC, forkit wrote: On Saturday, 13 November 2021 at 23:02:15 UTC, pascal111 wrote: I touch that D is big language, it's not small like standard C. This will cost me much studying, so I think I need slow down and learn it step by step. Yes. C is so

How to deploy single exe application (?)

2021-11-15 Thread Willem via Digitalmars-d-learn
Using D -- I have created a simple command line utility that download some info via a https API and save it in a sqlite3 database file. To use the exe on another windows machine, I need to copy over the relevant sqlite3 and curl DLL files. Question: Is there a way to create a single .exe

Re: Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread Imperatorn via Digitalmars-d-learn
On Monday, 15 November 2021 at 19:24:56 UTC, Sebastiaan Koppe wrote: On Monday, 15 November 2021 at 15:56:57 UTC, WebFreak001 wrote: is this currently possible or maybe possible with DIP1000? Yes it is. But besides `-dip1000` and `@safe`, it requires the use of a pointer: ```D @safe:

Re: Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread Ali Çehreli via Digitalmars-d-learn
On 11/15/21 1:58 PM, WebFreak001 wrote: > On Monday, 15 November 2021 at 19:24:56 UTC, Sebastiaan Koppe wrote: >> On Monday, 15 November 2021 at 15:56:57 UTC, WebFreak001 wrote: >>> is this currently possible or maybe possible with DIP1000? >> >> Yes it is. But besides `-dip1000` and `@safe`, it

Re: How to deploy single exe application (?)

2021-11-15 Thread russhy via Digitalmars-d-learn
On Monday, 15 November 2021 at 21:16:14 UTC, Willem wrote: Using D -- I have created a simple command line utility that download some info via a https API and save it in a sqlite3 database file. To use the exe on another windows machine, I need to copy over the relevant sqlite3 and curl DLL

Exceptions names list

2021-11-15 Thread pascal111 via Digitalmars-d-learn
I want to know where the list of exceptions names that "throw" statement uses. I searched in dlang site, and google but couldn't reach it.

Re: Exceptions names list

2021-11-15 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 00:03:14 UTC, Imperatorn wrote: On Monday, 15 November 2021 at 22:55:55 UTC, pascal111 wrote: On Monday, 15 November 2021 at 22:39:36 UTC, Imperatorn wrote: On Monday, 15 November 2021 at 22:28:28 UTC, pascal111 wrote: I want to know where the list of exceptions

Re: How to deploy single exe application (?)

2021-11-15 Thread pilger via Digitalmars-d-learn
On Monday, 15 November 2021 at 21:16:14 UTC, Willem wrote: Any feedback / pointers on where to start would be greatly appreciated. https://p0nce.github.io/d-idioms/#Embed-a-dynamic-library-in-an-executable

Re: Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread Imperatorn via Digitalmars-d-learn
On Monday, 15 November 2021 at 22:27:24 UTC, Ali Çehreli wrote: On 11/15/21 1:58 PM, WebFreak001 wrote: > [...] wrote: >> [...] wrote: >> [...] the use of >> [...] variable `file` > [...] copying the > [...] a pointer. I don't see how it solves the problem. Sebastiaan Koppe might have

Re: Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread Ali Çehreli via Digitalmars-d-learn
On 11/15/21 2:33 PM, Imperatorn wrote: On Monday, 15 November 2021 at 22:27:24 UTC, Ali Çehreli wrote: On 11/15/21 1:58 PM, WebFreak001 wrote: > [...] wrote: >> [...] wrote: >> [...] the use of >> [...] variable `file` > [...] copying the > [...] a pointer. I don't see how it solves the

Re: Exceptions names list

2021-11-15 Thread pascal111 via Digitalmars-d-learn
On Monday, 15 November 2021 at 22:44:35 UTC, Ali Çehreli wrote: On 11/15/21 2:28 PM, pascal111 wrote: > [...] "throw" statement > [...] Such a list is not very useful. Normally all we need is Exception and occasionally one or two other specific types. [...] What if I expect more than one

Re: Exceptions names list

2021-11-15 Thread Imperatorn via Digitalmars-d-learn
On Monday, 15 November 2021 at 22:28:28 UTC, pascal111 wrote: I want to know where the list of exceptions names that "throw" statement uses. I searched in dlang site, and google but couldn't reach it. Just so I understand, do you mean a list similar to this?

Re: Exceptions names list

2021-11-15 Thread pascal111 via Digitalmars-d-learn
On Monday, 15 November 2021 at 22:39:36 UTC, Imperatorn wrote: On Monday, 15 November 2021 at 22:28:28 UTC, pascal111 wrote: I want to know where the list of exceptions names that "throw" statement uses. I searched in dlang site, and google but couldn't reach it. Just so I understand, do you

arsd.simpledisplay on macos

2021-11-15 Thread Ben Jones via Digitalmars-d-learn
I'm trying to use Adam's simpledisplay on a mac with XQuartz which is installed + running. When I try to create a window, it crashes when calling `XDisplayConnection.get()`. I'm just building dub and have added `"arsd-official:simpledisplay"` as a dependency. Before I installed XQuartz, it

Re: Exceptions names list

2021-11-15 Thread Ali Çehreli via Digitalmars-d-learn
On 11/15/21 3:00 PM, pascal111 wrote: > On Monday, 15 November 2021 at 22:44:35 UTC, Ali Çehreli wrote: >> On 11/15/21 2:28 PM, pascal111 wrote: >> > [...] >> "throw" statement >> > [...] >> >> Such a list is not very useful. Normally all we need is Exception and >> occasionally one or two other