Re: Exceptions names list

2021-11-16 Thread bauss 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: > 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 t

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

2021-11-16 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 15 November 2021 at 22:49:12 UTC, Ali Çehreli wrote: Trying with it produces an error when 'new' is not used: Error: reference to local variable `file` assigned to non-scope parameter `p` calling deneme.ByChunk.opAssign The error is what the OP wanted, so that is expected. Althoug

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

2021-11-16 Thread Ali Çehreli via Digitalmars-d-learn
On 11/16/21 12:35 AM, Sebastiaan Koppe wrote: > Here the > OP wanted to (have the compiler) destroy the FileReader when it left the > scope, while disallowing any use after free. Thanks! That's what I missed. Ali

Re: Exceptions names list

2021-11-16 Thread Ali Çehreli via Digitalmars-d-learn
On 11/16/21 12:30 AM, bauss wrote: > On Monday, 15 November 2021 at 22:44:35 UTC, Ali Çehreli wrote: >> 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 Ex

Re: Exceptions names list

2021-11-16 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 09:29:34 UTC, Ali Çehreli wrote: Further, it doesn't feel right to throw e.g. std.conv.ConvException from my foo.bar module. The cases where another module's exception fitting my use closely feels so rare that I wouldn't even think about reaching for an existing

Re: Exceptions names list

2021-11-16 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 00:10:44 UTC, Imperatorn wrote: 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 U

Re: Exceptions names list

2021-11-16 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 09:41:15 UTC, Ola Fosheim Grøstad wrote: want to follow the same error handling pattern so that user code can replace a standard library function with an enhanced third party function without changing the error handling code down the call-tree. Eh, *up* the cal

Re: Exceptions names list

2021-11-16 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 10:28:18 UTC, Imperatorn wrote: I just did a quick grep of phobos and matched the derived exceptions and got this: Base64Exception MessageMismatch OwnerTerminated LinkTerminated PriorityMessageException MailboxFull TidMissingException ConvException CSVException En

Re: Exceptions names list

2021-11-16 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 11:54:43 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 16 November 2021 at 10:28:18 UTC, Imperatorn wrote: I just did a quick grep of phobos and matched the derived exceptions and got this: Base64Exception MessageMismatch OwnerTerminated LinkTerminated PriorityMess

Re: arsd.simpledisplay on macos

2021-11-16 Thread Adam Ruppe via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 03:41:31 UTC, Ben Jones wrote: 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()`. Hmm, I have never actually seen that fail since the mac

Jupyter notebook with Dlang

2021-11-16 Thread Imperatorn via Digitalmars-d-learn
https://forum.dlang.org/post/pvwbeqzvktovnhoag...@forum.dlang.org On Wednesday, 29 April 2020 at 15:49:05 UTC, Jan Hönig wrote: Today I have been toying around with jupyter. I wanted to know how it works (since I use it with Python all the time). I was trying to couple xeus[3] with drepl[4] to

Re: Jupyter notebook with Dlang

2021-11-16 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 14:40:01 UTC, Imperatorn wrote: https://forum.dlang.org/post/pvwbeqzvktovnhoag...@forum.dlang.org On Wednesday, 29 April 2020 at 15:49:05 UTC, Jan Hönig wrote: [snip] I would also like to know this! I would also be interested.

Re: arsd.simpledisplay on macos

2021-11-16 Thread Ben Jones via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 14:38:47 UTC, Adam Ruppe wrote: 1) run xquartz separately to ensure it is up 2) set hte DISPLAY=:0 environment variable before starting the sdpy app Adding DISPLAY:0 fixed it, thanks. If I get time, I'll take a look at the objective C stuff, but that's a big

Using in one class a constant defined in another class

2021-11-16 Thread chopchop via Digitalmars-d-learn
Hi, I have a class Ground which defines some playground constants (at least constant to the class): ``` class Ground { immutable WALL = -2; immutable playgroundWidth = 77; immutable playgroundHeight = 22; ... } ``` Now, in another class "Player", I would like to

Re: Using in one class a constant defined in another class

2021-11-16 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 18:12:34 UTC, chopchop wrote: class Ground { immutable WALL = -2; immutable isn't automatically static, so you'd want to use `static immutable` to share the value across all instances. (you can actually initialize immutable things to different

Re: Using in one class a constant defined in another class

2021-11-16 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 18:12:34 UTC, chopchop wrote: Hi, I have a class Ground which defines some playground constants (at least constant to the class): ``` class Ground { immutable WALL = -2; immutable playgroundWidth = 77; immutable playgroundHeight =

Re: arsd.simpledisplay on macos

2021-11-16 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 17:39:19 UTC, Ben Jones wrote: Adding DISPLAY:0 fixed it, thanks. ah, good to know! I probably set that as an automatic script on my old test computer and forgot about it. (It beeps at me now when I turn it on... apparently failed memory. alas.) If I get time

Data conversion

2021-11-16 Thread pascal111 via Digitalmars-d-learn
I used "to" keyword which "std.conv" includes for data conversions, but I think that there are some other ways for data conversions, or maybe there are common ways like casting, I hope to know about. For example, next program are using "to": // D programming language import std.stdio; import

Re: Data conversion

2021-11-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 19:18:50 UTC, pascal111 wrote: I used "to" keyword which "std.conv" includes for data conversions, but I think that there are some other ways for data conversions, or maybe there are common ways like casting, I hope to know about. For example, next program are us

Re: Data conversion

2021-11-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 19:44:04 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 16 November 2021 at 19:18:50 UTC, pascal111 wrote: [...] sscanf of C is an option where you cannot use to!T. However, it is a c library function, and it doesn't throw an exception on unexpected inputs. https:

Re: Data conversion

2021-11-16 Thread jfondren via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 19:18:50 UTC, pascal111 wrote: I used "to" keyword which "std.conv" includes for data conversions, but I think that there are some other ways for data conversions, or maybe there are common ways like casting, I hope to know about. For example, next program are us

Are templated functions always re-constructed?

2021-11-16 Thread rempas via Digitalmars-d-learn
Let's say that I have the following function: ``` void add(T)(T val, T val2) { return val + val2; } // Classic example, lol ``` Now let's say that I call the function passing an `int` parameter. The function will get built with an `int` type. What happens the second time that I will call it

Re: Are templated functions always re-constructed?

2021-11-16 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Nov 16, 2021 at 09:14:50PM +, rempas via Digitalmars-d-learn wrote: > Let's say that I have the following function: > > ``` > void add(T)(T val, T val2) { return val + val2; } // Classic example, lol > ``` > > Now let's say that I call the function passing an `int` parameter. The > fu

French and Greek strings

2021-11-16 Thread pascal111 via Digitalmars-d-learn
How can I use types to make string and char variables that hold French and Greek characters?

Re: French and Greek strings

2021-11-16 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Nov 17, 2021 at 12:58:43AM +, pascal111 via Digitalmars-d-learn wrote: > How can I use types to make string and char variables that hold French > and Greek characters? For strings, just use `string`. :-) D strings are Unicode by default, no further effort is needed to use it. Indivi

Simple text editor program

2021-11-16 Thread pascal111 via Digitalmars-d-learn
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.

Re: Are templated functions always re-constructed?

2021-11-16 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 16 November 2021 at 21:14:50 UTC, rempas wrote: Let's say that I have the following function: ``` void add(T)(T val, T val2) { return val + val2; } // Classic example, lol ``` Now let's say that I call the function passing an `int` parameter. The function will get built with an `

Re: Simple text editor program

2021-11-16 Thread Ali Çehreli via Digitalmars-d-learn
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 searching for 'editor' finds some packages: https://code.dlang.org