Re: vibe.d compilation error

2021-07-04 Thread seany via Digitalmars-d-learn
On Monday, 5 July 2021 at 01:11:22 UTC, Mathias LANG wrote: On Sunday, 4 July 2021 at 12:36:24 UTC, seany wrote: Is there any way, I can avoid this error? You are using an old version of Vibe.d, change your dependency to "~>0.9.0". Okey, thank you. That resolved it.

Re: vibe.d compilation error

2021-07-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 July 2021 at 12:36:24 UTC, seany wrote: Is there any way, I can avoid this error? You are using an old version of Vibe.d, change your dependency to "~>0.9.0".

Re: Is there an alias for standard libraries to use in import statement?

2021-07-04 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 4 July 2021 at 07:40:44 UTC, BoQsc wrote: I just started with a fresh look at the D language and would like to be able to rewrite this code: import std; void main() { writeln("Hello D"); } Into more readable standard library name: import system; void main() {

Re: Is there an alias for standard libraries to use in import statement?

2021-07-04 Thread BoQsc via Digitalmars-d-learn
On Sunday, 4 July 2021 at 08:50:54 UTC, Mike Parker wrote: You can use named imports, but then you have to use the name as a namespace: ``` import system = std; void main() { system.writeln("Hello D"); } ``` These were the examples that might feel more readable and natural than

Re: anonymous functions and scope(exit)

2021-07-04 Thread frame via Digitalmars-d-learn
On Sunday, 4 July 2021 at 10:07:08 UTC, jfondren wrote: Not cleaning up after an Error is thrown is allowed by the D spec. This enhancement allows much better code to be generated for `nothrow` code when `scope` is used. It will also not unwind declarations with destructors in `nothrow` code

Re: how much "real-life" code can be marked @safe ?

2021-07-04 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 4 July 2021 at 08:43:11 UTC, Alexandru Ermicioi wrote: On Saturday, 3 July 2021 at 20:09:56 UTC, tsbockman wrote: On Saturday, 3 July 2021 at 16:06:33 UTC, Alexandru Ermicioi wrote: 3. An edge case. Ex: You need to mutate some data and then assume it is immutable in a constructor.

vibe.d compilation error

2021-07-04 Thread seany via Digitalmars-d-learn
Compiling a simple vibe.d project throws tis error : `/root/.dub/packages/vibe-d-0.8.6/vibe-d/utils/vibe/internal/memory_legacy.d(9,8): Error: module `std.exception` import `enforceEx` not found, did you mean template `std.exception.enforce(E : Throwable = Exception) if (is(typeof(new E("",

Re: anonymous functions and scope(exit)

2021-07-04 Thread Luis via Digitalmars-d-learn
On Sunday, 4 July 2021 at 10:07:08 UTC, jfondren wrote: On Sunday, 4 July 2021 at 08:24:36 UTC, Luis wrote: Dennis's explanation makes the most sense: writeln can throw an Exception, so its presence prevents nothrow inference, which otherwise permits the (not intended to be catchable)

Re: anonymous functions and scope(exit)

2021-07-04 Thread jfondren via Digitalmars-d-learn
On Sunday, 4 July 2021 at 10:07:08 UTC, jfondren wrote: By that, what you're running into is an unpleasant interaction between 1. scope(exit)s that you're writing 2. Errors being thrown rather than Exceptions 3. anonymous functions getting inferred as nothrow And a resolution could be to

Re: anonymous functions and scope(exit)

2021-07-04 Thread jfondren via Digitalmars-d-learn
On Sunday, 4 July 2021 at 08:24:36 UTC, Luis wrote: On Saturday, 3 July 2021 at 22:52:39 UTC, frame wrote: It works if you replace printf() with writeln() or use writeln() after. There must be some buffer issue. Not works as you expected. Yes, replacing by writeln (better said, putting a

Re: Is there an alias for standard libraries to use in import statement?

2021-07-04 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 4 July 2021 at 07:40:44 UTC, BoQsc wrote: I just started with a fresh look at the D language and would like to be able to rewrite this code: import std; void main() { writeln("Hello D"); } Into more readable standard library name: import system; void main() {

Re: how much "real-life" code can be marked @safe ?

2021-07-04 Thread Alexandru Ermicioi via Digitalmars-d-learn
On Saturday, 3 July 2021 at 20:09:56 UTC, tsbockman wrote: On Saturday, 3 July 2021 at 16:06:33 UTC, Alexandru Ermicioi wrote: 3. An edge case. Ex: You need to mutate some data and then assume it is immutable in a constructor. Can you give a valid example where that is necessary? The main

Re: anonymous functions and scope(exit)

2021-07-04 Thread Luis via Digitalmars-d-learn
On Saturday, 3 July 2021 at 22:52:39 UTC, frame wrote: On Saturday, 3 July 2021 at 22:04:04 UTC, Luis wrote: scope(exit) it's syntactic sugar for a classic `try {} finally {}` . The documentation says that must be executed. It works if you replace printf() with writeln() or use writeln()

Is there an alias for standard libraries to use in import statement?

2021-07-04 Thread BoQsc via Digitalmars-d-learn
I just started with a fresh look at the D language and would like to be able to rewrite this code: import std; void main() { writeln("Hello D"); } Into more readable standard library name: import system; void main() { writeln("Hello D"); } Or into this import library.standard;