Re: Is D programming friendly for beginners?

2024-03-12 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 11 March 2024 at 12:30:10 UTC, Doigt wrote: On Monday, 4 March 2024 at 13:37:53 UTC, Fidele wrote: I want to start learning D programming language it looks interesting Depends what you mean by "beginner". If you've never programmed before and D is your first language, then the

Re: Using ImportC to augment a big C project with D

2024-02-21 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 20 February 2024 at 18:33:42 UTC, Carl Sturtivant wrote: 2. The C source calls exit() from C's stdlib, and D needs to terminate properly. What do you mean by "need"? You can call https://dlang.org/phobos/core_stdc_stdlib.html#.exit from D: ```d import std.stdio; void main() {

Re: Fluid 0.6.0 — UI library for D

2024-01-31 Thread Bastiaan Veelo via Digitalmars-d-announce
On Wednesday, 31 January 2024 at 06:38:17 UTC, aberba wrote: On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch wrote: Fluid is a library I started developing 3 years ago when I joined the D community, after failing to find a suitable library for my gamedev project. [...] Could you

Re: Upcoming talk at FOSDEM 2024 - The D Programming Language for Modern Open Source Development

2024-01-27 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 15 January 2024 at 00:49:25 UTC, matheus wrote: On Sunday, 14 January 2024 at 23:16:40 UTC, Mike Shah wrote: Hi D Community, My talk on how I'm using the D programming language and why I think it is an excellent language choice for open source projects will be featured at FOSDEM

Re: Upcoming talk at FOSDEM 2024 - The D Programming Language for Modern Open Source Development

2024-01-16 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 15 January 2024 at 00:49:25 UTC, matheus wrote: On Sunday, 14 January 2024 at 23:16:40 UTC, Mike Shah wrote: Hi D Community, My talk on how I'm using the D programming language and why I think it is an excellent language choice for open source projects will be featured at FOSDEM

Re: `static` function ... cannot access variable in frame of ...

2024-01-16 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 15 January 2024 at 23:06:00 UTC, Steven Schveighoffer wrote: As a workaround, you can alias the outer function in the struct: ```d struct S { alias foo = S_foo; } ``` This might be less than ideal, but at least it works. It does! And it's good enough for me. Thanks a lot! --

Re: `static` function ... cannot access variable in frame of ...

2024-01-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 15 January 2024 at 18:43:43 UTC, user1234 wrote: The two calls are not equivalent. so what is passed as alias need to be static too. Thanks all. I thought a static member function just isn't able to access the instance of the struct, but as I understand now it is static all the

`static` function ... cannot access variable in frame of ...

2024-01-15 Thread Bastiaan Veelo via Digitalmars-d-learn
Hey people, I can use some help understanding why the last line produces a compile error. ```d import std.stdio; struct S { static void foo(alias len)() { writeln(len); } } void S_foo(alias len)() { writeln(len); } void main() { const five = 5; S_foo!five; //

Re: Beta 2.107.0

2024-01-06 Thread Bastiaan Veelo via Digitalmars-d-announce
On Tuesday, 2 January 2024 at 12:49:51 UTC, Iain Buclaw wrote: http://dlang.org/changelog/2.107.0.html **@standalone** is a new attribute that can be used to mark module constructors that run after druntime has been initialized, but do not depend on any other module constructors being run

Re: D Language Foundation October 2023 Quarterly Meeting Summary

2023-12-12 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 11 December 2023 at 19:55:38 UTC, Timon Gehr wrote: ... this successfully injects alloca into the caller's scope. ```d import core.stdc.stdlib:alloca; import std.range:ElementType; import core.lifetime:moveEmplace; struct VLA(T,alias len){ T[] storage; this(R)(R

Re: D Language Foundation October 2023 Quarterly Meeting Summary

2023-12-11 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 10 December 2023 at 22:59:06 UTC, Nicholas Wilson wrote: Always happy to help if you're interested in looking into using dcompute. Thank you, I'll let you know! Or you could use grep with `--output-ll` as noted by Johan

Re: D Language Foundation October 2023 Quarterly Meeting Summary

2023-12-10 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 10 December 2023 at 18:16:05 UTC, Nick Treleaven wrote: You can call `alloca` as a default argument to a function. The memory will be allocated on the caller's stack before calling the function: https://github.com/ntrel/stuff/blob/master/util.d#L113C1-L131C2 I've just tested and it

Re: D Language Foundation October 2023 Quarterly Meeting Summary

2023-12-10 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 10 December 2023 at 17:11:04 UTC, Siarhei Siamashka wrote: On Sunday, 10 December 2023 at 15:08:05 UTC, Bastiaan Veelo wrote: The compiler can check if `scope` delegates escape a function, but it only does this in `@safe` code --- and our code is long from being `@safe`. So it was a

Re: D Language Foundation October 2023 Quarterly Meeting Summary

2023-12-10 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 10 December 2023 at 15:31:55 UTC, Richard (Rikki) Andrew Cattermole wrote: It will be interesting to hear how dcompute will fare in your situation, due to it being D code it should be an incremental improvement once you're ready to move to D fully. Yes, dcompute could mean

Re: D Language Foundation October 2023 Quarterly Meeting Summary

2023-12-10 Thread Bastiaan Veelo via Digitalmars-d-announce
On Wednesday, 6 December 2023 at 16:28:08 UTC, Mike Parker wrote: Bastiaan reported that SARC had been testing their D codebase (transpiled from Pascal---[see Bastiaan's DConf 2019 talk](https://youtu.be/HvunD0ZJqiA)). They'd found the multithreaded performance worse than the Pascal version.

Re: New DUB documentation

2023-11-27 Thread Bastiaan Veelo via Digitalmars-d-announce
On Friday, 24 November 2023 at 11:11:53 UTC, BoQsc wrote: Darker blending indistinct colors (dark red, dark background), way smaller fonts. I see your screenshots, but that is not what it looks like for me in Chrome on Windows. I am seeing black text on white background with red links.

Re: New DUB documentation

2023-11-23 Thread Bastiaan Veelo via Digitalmars-d-announce
On Wednesday, 22 November 2023 at 21:35:34 UTC, WebFreak001 wrote: the revamped DUB documentation I started a while ago is now deployed on https://dub.pm This is very much appreciated. A job well done! -- Bastiaan.

Re: Returning a reference to be manipulated

2023-04-14 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 14 April 2023 at 00:50:31 UTC, kdevel wrote: ``` ref int foo (ref int i) { return i; } ref int bar () { int i; return foo (i); } void main () { import std.stdio; auto i = bar; i.writeln; } ``` Up to dmd v2.100.2 I am warned/get an error during compilation: ``` $

Re: Traverse a DList and insert / remove in place?

2023-03-25 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 19 March 2023 at 13:15:58 UTC, Armando wrote: I would like to do something like traversing a DList, operating on the current element, and potentially removing that element or inserting a new one before/after it - an easy operation if you code a DList yourself. Maybe I missed

Re: Beta 2.103.0

2023-03-02 Thread Bastiaan Veelo via Digitalmars-d-announce
On Thursday, 2 March 2023 at 16:40:12 UTC, jmh530 wrote: Any reason why it doesn't match the options from DMD? See the [changelog](https://dlang.org/changelog/2.103.0.html#colors): The previous **automatic**, **on**, **off** values are still supported, but undocumented, because they are used

Re: toString best practices

2023-02-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 9 February 2023 at 17:49:58 UTC, Paolo Invernizzi wrote: ``` import std.format, std.range.primitives; struct Point(T) { T x, y; void toString(W)(ref W writer, scope const ref FormatSpec!char f) const if (isOutputRange!(W, char)) { put(writer, "(");

Re: Safer Linux Kernel Modules Using the D Programming Language

2023-01-07 Thread Bastiaan Veelo via Digitalmars-d-announce
On Thursday, 5 January 2023 at 20:24:07 UTC, Alexandru Militaru wrote: Hi everyone, If you remember the "D for a @safer Linux Kernel“ talk from DConf 2019 [1], then you might want to read our paper [2] on that matter that was just published in IEEE Access Journal. [1]

Re: Beta 2.102.0

2023-01-04 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 2 January 2023 at 12:21:43 UTC, Hipreme wrote: `pragma(lib)` seems to be broken Can you file an issue for this please, if you've not done so yet? https://dlang.org/bugstats.html -- Bastiaan.

Re: D Language Foundation October 2022 Quarterly Meeting Summary

2022-11-04 Thread Bastiaan Veelo via Digitalmars-d-announce
On Wednesday, 2 November 2022 at 18:20:42 UTC, H. S. Teoh wrote: On Wed, Nov 02, 2022 at 06:11:12PM +, M. M. via Digitalmars-d-announce wrote: Thank you to Martin Nowak for all his as release manager. Happy to hear that someone like Ian took over. I'm just curious why Martin stepped down.

Re: D Language Foundation July 2022 Quarterly Meeting Summary

2022-09-02 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 28 August 2022 at 10:37:03 UTC, Mike Parker wrote: This summary is quite a bit overdue. Sorry for the delay. Thanks for this, and for keeping all the details. Good work! — Bastiaan.

Re: D Language Foundation July 2022 Quarterly Meeting Summary

2022-09-02 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 28 August 2022 at 11:04:45 UTC, Steven Schveighoffer wrote: On 8/28/22 6:37 AM, Mike Parker wrote: SARC has marked a major milestone in that their 500KLOC Extended Pascal codebase has been completely transcompiled to D This is awesome! I remember that talk, and it was very

Re: How do you work with lst files?

2022-08-25 Thread Bastiaan Veelo via Digitalmars-d-learn
On Wednesday, 24 August 2022 at 22:29:51 UTC, Christian Köstlin wrote: I want to ask around how you from the dlang community work with .lst coverage files? No personal experience, but there are half a dozen options on https://code.dlang.org/search?q=Coverage — Bastiaan.

Re: How to escape control characters?

2022-08-23 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 31 March 2016 at 03:15:49 UTC, cy wrote: This might be a dumb question. How do I format a string so that all the newlines print as \n and all the tabs as \t and such? The easiest is this: ```d import std.conv; string str = `Hello "World" line 2`; writeln([str].text[2..$-2]); //

Re: New WIP DUB documentation

2022-08-18 Thread Bastiaan Veelo via Digitalmars-d-announce
On Thursday, 18 August 2022 at 14:00:38 UTC, Martin Tschierschke wrote: What about the following idea about **comments for dub.json**: Allow the key "comment" inside the json file and alter DUB to remove all "comment" key value pairs at the beginning of parsing. So the file is still valid json

Re: New WIP DUB documentation

2022-08-18 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 15 August 2022 at 21:32:23 UTC, WebFreak001 wrote: Hi all, I'm currently working on new revamped DUB documentation, check it out if you want, it currently contains most old documentation plus a big bunch of new documentation: https://docs.webfreak.org/ Thank you for doing this!

Re: DConf '22 Livestream Links

2022-08-01 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 1 August 2022 at 12:45:56 UTC, Matheus wrote: On Monday, 25 July 2022 at 13:52:51 UTC, Mike Parker wrote: For those of you who can't join us in person at DConf '22 in London next week, you can join us instead via each day's livestream link: * Day 1: https://youtu.be/V6KFtzF2Hx8

Re: [i18n] Gettext 1.0.1 released

2022-07-20 Thread Bastiaan Veelo via Digitalmars-d-announce
On Tuesday, 19 July 2022 at 20:20:29 UTC, Ogi wrote: Is this tested on Windows? Yes, it is developed on Windows. Do the included tests work for you? ``` Target is a library. Skipping execution. ``` That is not right. Are you developing a library or an application? If you cannot get it to

Re: Blog post on extending attribute inference to more functions

2022-07-18 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 17 July 2022 at 18:33:47 UTC, AnimusPEXUS wrote: I've just coded something and come with the idea of @todo/@fixme/@issueid attributes, so compiler write messages each time it finds those. Just as a thought.. maybe It can be useful, although it's already can be done with pragma(msg,

[i18n] Gettext 1.0.1 released

2022-07-18 Thread Bastiaan Veelo via Digitalmars-d-announce
Two years ago, H. S. Teoh presented a proof of concept for [automatic extraction of gettext-style translation strings](https://forum.dlang.org/post/mailman.2526.1585832475.31109.digitalmar...@puremagic.com). I recently combined that idea with the existing

Re: How do I download the Windows DMD installer?

2022-07-17 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 17 July 2022 at 19:58:03 UTC, LeMondaide wrote: When I try (https://dlang.org/ or https://dlang.org/download.html) I am sent here: https://s3.us-west-2.amazonaws.com/downloads.dlang.org/releases/2022/dmd-2.100.1.exe and get this message "AccessDeniedAccess

Re: Null terminated character

2022-07-02 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 23 June 2022 at 16:16:26 UTC, vc wrote: I've try this '\0'*10 and didn't work, i want the results be \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 ```d string nulls = '\0'.repeat(10).array; ``` — Bastiaan.

Re: Why allow initializers of non-static members that allocate?

2022-06-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 11 June 2022 at 10:52:58 UTC, Mike Parker wrote: I agree with your initial assessment that it should be an error. It really only makes sense to allow the dynamic allocation if the fields are immutable and, in the case of arrays, the initializer is a literal. 

Re: Why allow initializers of non-static members that allocate?

2022-06-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 11 June 2022 at 01:52:58 UTC, Mike Parker wrote: People getting bit by `new` in field initialization often enough that I think a warning would be helpful. The problem is so much bigger because it is not just a case of being aware not to use `new` in member initialisers. As you

Re: Why allow initializers of non-static members that allocate?

2022-06-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 10 June 2022 at 14:56:24 UTC, Steven Schveighoffer wrote: On 6/10/22 3:46 AM, Mike Parker wrote: I think this is a case where having a warning that's on by default, and which can be explicitly disabled, is useful. "Blah blah .init blah blah. See link-to-something-in-docs. Is this

Re: Why allow initializers of non-static members that allocate?

2022-06-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 10 June 2022 at 07:49:43 UTC, Mike Parker wrote: And it *is* documented: Struct fields are by default initialized to whatever the Initializer for the field is, and if none is supplied, to the default initializer for the field's type. The default initializers are evaluated at

Re: Why allow initializers of non-static members that allocate?

2022-06-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 10 June 2022 at 07:46:36 UTC, Mike Parker wrote: On Friday, 10 June 2022 at 07:35:17 UTC, Bastiaan Veelo wrote: Is there a use case where this makes sense? I would have much appreciated the compiler slapping me on the fingers, but it doesn't. I understand that it is safe and that

Why allow initializers of non-static members that allocate?

2022-06-10 Thread Bastiaan Veelo via Digitalmars-d-learn
I have been foolish enough to make a mistake like this: ```d struct S { int[] arr = new int[](5); } ``` This is terrible because ```d S s1; S s2; s2.arr[0] = 42; writeln(s1.arr[0]); // 42 Gotcha! ``` Of course there are less obvious variants of the same mistake: ```d import std; struct S {

Re: cogito, cognitive complexity for D

2022-05-25 Thread Bastiaan Veelo via Digitalmars-d-announce
On Tuesday, 24 May 2022 at 21:25:38 UTC, Christian Köstlin wrote: if the dmd frontend could be made available as a dub package, It already is, as sub package of https://code.dlang.org/packages/dmd — Bastiaan.

Re: Library for image editing and text insertion

2022-04-27 Thread Bastiaan Veelo via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 09:27:24 UTC, Alexander Zhirov wrote: Now I would like to reduce the size of the executable file and it would be great at all! Try the `-release` option to `dmd`. Or use LDC. -- Bastiaan.

Re: Language server

2022-04-27 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 26 April 2022 at 18:15:57 UTC, Alain De Vos wrote: In a perfect world there would be someone uploading a youtube video how to implement neovim with a dlang language-server. With function-completions-help where hints are given about the functions and libraries. If anyone could do

Re: Beta 2.100.0

2022-04-23 Thread Bastiaan Veelo via Digitalmars-d-announce
On Friday, 22 April 2022 at 09:24:00 UTC, Martin Nowak wrote: http://dlang.org/changelog/2.100.0.html It seems the list of contributors does not include the contributions to Dub. — Bastiaan.

Re: How to use Vector Extensions in an opBinary

2022-04-21 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 21 April 2022 at 15:31:04 UTC, HuskyNator wrote: On Sunday, 17 April 2022 at 17:04:57 UTC, Bastiaan Veelo wrote: You might want to have a look at https://code.dlang.org/packages/intel-intrinsics — Bastiaan. This does not discuss core.simd or __vector type, or did I

Re: Can Enums be integral types?

2022-04-19 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 19 April 2022 at 01:25:13 UTC, Era Scarecrow wrote: The 'integral' or numeric value is used for uniqueness, […] There is nothing that requires enum values to be unique, though: ```d import std; void main() { enum E {Zero = 0, One = 0, Two = 0} writeln(E.Two); // Zero! } ```

Re: Can Enums be integral types?

2022-04-17 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 16 April 2022 at 11:39:01 UTC, Manfred Nowak wrote: In the specs(17) about enums the word "integral" has no match. But because the default basetype is `int`, which is an integral type, enums might be integral types whenever their basetype is an integral type. On the other hand

Re: How to use Vector Extensions in an opBinary

2022-04-17 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 17 April 2022 at 11:16:25 UTC, HuskyNator wrote: I recently found out there is [support for vector extensions](https://dlang.org/spec/simd.html) But I have found I don't really understand how to use it, not even mentioning the more complex stuff. I couldn't find any good examples

Re: D Language Foundation Monthly Meeting Summary for March 2022

2022-04-05 Thread Bastiaan Veelo via Digitalmars-d-announce
On Monday, 4 April 2022 at 10:59:39 UTC, Mike Parker wrote: ### D ecosystem services While we were waiting for everyone to arrive, I gave an update on the status of our plans to bring all of the ecosystem services under our control. At that point, I had received information on the resource

Re: D Language Foundation Monthly Meeting for February 2022

2022-03-05 Thread Bastiaan Veelo via Digitalmars-d-announce
On Saturday, 5 March 2022 at 14:03:38 UTC, Mike Parker wrote: On Saturday, 5 March 2022 at 12:39:39 UTC, Bastiaan Veelo wrote: On Saturday, 5 March 2022 at 01:21:06 UTC, Mike Parker wrote: But we have no reason to move the D projects away from GitHub to GitLab. GitLab has never entered the

Re: D Language Foundation Monthly Meeting for February 2022

2022-03-05 Thread Bastiaan Veelo via Digitalmars-d-announce
On Saturday, 5 March 2022 at 01:21:06 UTC, Mike Parker wrote: But we have no reason to move the D projects away from GitHub to GitLab. GitLab has never entered the conversation. Two reasons would be that 1) It already offers [an integration with

Re: D Language Foundation Monthly Meeting for February 2022

2022-02-28 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 27 February 2022 at 11:53:18 UTC, Mike Parker wrote: ## Monthly Meeting Just letting you know that it is posts like these that I look forward to the most, and I very much appreciate the work that goes into them. Thanks! — Bastiaan.

Re: package libs on windows

2022-02-01 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 1 February 2022 at 21:17:09 UTC, Abby wrote: I would like to know if there is a way to set path to lib to downloaded with package instead of harcoded. That’s documented on the [package page](https://code.dlang.org/packages/d2sqlite3). Are you trying to link with a separately

Re: std.signals: Why emit() not extist?

2021-12-30 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 30 December 2021 at 19:13:10 UTC, Marcone wrote: I get this error: Error: undefined identifier `emit`, did you mean function `exit`? Did you `import std.signals`? — Bastiaan.

Re: First time using Parallel

2021-12-26 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 26 December 2021 at 15:20:09 UTC, Bastiaan Veelo wrote: So if you use `workerLocalStorage` to give each thread an `appender!string` to write output to, and afterwards write those to `stdout`, you'll get your output in order without sorting. Scratch that, I misunderstood the

Re: First time using Parallel

2021-12-26 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 26 December 2021 at 06:10:03 UTC, Era Scarecrow wrote: [...] ```d foreach(value; taskPool.parallel(range) ){code} ``` [...] Now said results are out of order [...] So I suppose, is there anything I need to know? About shared resources or how to wait until all threads are

Re: Printed version of the Vibe.d tutorial

2021-12-19 Thread Bastiaan Veelo via Digitalmars-d-announce
On Sunday, 19 December 2021 at 21:57:50 UTC, Rey Valeza wrote: Hi, The printed version of the Vibe.d tutorial 'Build web apps in Vibe.d by learning from a learner' which I uploaded earlier in February this year is now available in paperback at Amazon: https://www.amazon.com/dp/B09MYTMNKF

Re: Why does is the RandomAccessInfinite interface not a valid RandomAccessRange?

2021-12-19 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 19 December 2021 at 09:19:31 UTC, D Lark wrote: Do you know if there's a nightly version I can specify to use your fix? Are you inheriting from `RandomAccessInfinite`? Then you can probably add ```d static if (__VERSION__ < 2099) enum bool empty = false; ``` to make it work.

Re: DMD32 D Compiler v2.097.2-dirty ?

2021-09-08 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 6 September 2021 at 15:37:31 UTC, Paul wrote: I like to write CLEAN code:) Why does my DMD installation say v2.097.2-dirty? https://forum.dlang.org/post/qqxmnoshytmzflviw...@forum.dlang.org I suppose it is due to how the scripts work that produce the compiler release. I guess

Re: Curious effect with traits, meta, and a foreach loop ... mystifies me.

2021-09-08 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 7 September 2021 at 17:24:34 UTC, james.p.leblanc wrote: ```d /*…*/ // this is fine (notice that 'val' is never used foreach( i, val ; u.tupleof ){ ptr = u.tupleof[i].x.ptr; writeln("ptr: ", ptr); } // this fails with: "Error: variable 'i' cannot be read at

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ``` dmd says it's not Ok: t.d(14): Error: class `t.C2`

Re: simple (I think) eponymous template question ... what is proper idimatic way ?

2021-08-17 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 20:29:51 UTC, james.p.leblanc wrote: So, below is my code: import std.stdio; import std.meta : AliasSeq; template isAmong(T, S...) { static if (S.length == 0) enum isAmong = false; else enum isAmong = is(T == S) || isAmong(T, S[1..$]); } alias

Re: Getting a working example of opIndexAssign using opSlice ... have troubles ...

2021-08-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 15 August 2021 at 20:41:51 UTC, james.p.leblanc wrote: struct A { int opIndexAssign(int v); // overloads a[] = v int opIndexAssign(int v, size_t[2] x); // overloads a[i .. j] = v int[2] opSlice(size_t x, size_t y); // overloads i .. j }

Re: D has the same memory model as C++

2021-08-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Wednesday, 11 August 2021 at 05:33:06 UTC, Tejas wrote: On Tuesday, 10 August 2021 at 21:19:39 UTC, Bastiaan Veelo wrote: On Tuesday, 10 August 2021 at 16:00:37 UTC, Tejas wrote: Basically, what are the subtle gotcha's in the differences between C++ and D code that looks similar The only

Re: D has the same memory model as C++

2021-08-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 10 August 2021 at 18:13:17 UTC, Tejas wrote: On Tuesday, 10 August 2021 at 18:07:35 UTC, Bastiaan Veelo wrote: On Tuesday, 10 August 2021 at 16:00:37 UTC, Tejas wrote: there's casting away const, a clearly seperate language feature which has no equivalent in D; You *can* cast

Re: D has the same memory model as C++

2021-08-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 10 August 2021 at 16:00:37 UTC, Tejas wrote: Basically, what are the subtle gotcha's in the differences between C++ and D code that looks similar The only gotcha that comes to my mind is that `private` means private to the module in D, not private to the aggregate. — Bastiaan.

Re: D has the same memory model as C++

2021-08-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 10 August 2021 at 16:00:37 UTC, Tejas wrote: there's casting away const, a clearly seperate language feature which has no equivalent in D; You *can* cast away `const` in D: https://run.dlang.io/is/sWa5Mf — Bastiaan.

Re: Error when compile with DMD using -m64?

2021-08-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 10 August 2021 at 17:13:31 UTC, Marcone wrote: On Tuesday, 10 August 2021 at 15:55:42 UTC, Bastiaan Veelo wrote: Use `size_t` and `ptrdiff_t` instead to make your program compile in both 32 bit and 64 bit modes. https://dlang.org/spec/type.html#aliased-types -- Bastiaan. Thank

Re: Error when compile with DMD using -m64?

2021-08-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 10 August 2021 at 01:29:04 UTC, Marcone wrote: Solved converting long and int. Use `size_t` and `ptrdiff_t` instead to make your program compile in both 32 bit and 64 bit modes. https://dlang.org/spec/type.html#aliased-types -- Bastiaan.

Re: How Add Local modules mymodule.d using DUB?

2021-08-09 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 9 August 2021 at 16:32:13 UTC, Marcone wrote: My main program need import a local module called mymodule.d. How can I add this module using DUB? Thank you. Let’s assume you just created a dub project in `myproject` with `dub init`. Place `mymodule.d` alongside `app.d` in

Re: writef, compile-checked format, pointer

2021-08-09 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 9 August 2021 at 22:01:18 UTC, Patrick Schluter wrote: On Monday, 9 August 2021 at 19:38:28 UTC, novice2 wrote: format!"fmt"() and writef!"fmt"() templates with compile-time checked format string not accept %X for pointers, but format() and writef() accept it

Re: Exit before second main with -funittest

2021-07-30 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 30 July 2021 at 05:51:41 UTC, Brian Tiffin wrote: [... interesting account of the D experience ...] **Kudos team and contributors.** Can't really suggest that many improvements to resources needed for learning D, as a hobbyist not on a clock, being new still and low enough to not

Re: D Language Foundation Quarterly Meeting Summary -- July 23, 2021

2021-07-28 Thread Bastiaan Veelo via Digitalmars-d-announce
On Wednesday, 28 July 2021 at 06:37:56 UTC, Mike Parker wrote: * Joseph Rushton Wakeling representing Frequenz I know Joseph, but haven't heard of Frequenz. Can't find them on https://dlang.org/orgs-using-d.html. Is there any news to be announced? -- Bastiaan.

Re: how to make D program footprint smaller ?

2021-07-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 9 July 2021 at 03:07:04 UTC, dangbinghoo wrote: as questioned in the previous thread, I need to find out something like `--as-needed` options available for D. You are probably looking for the [-i](https://dlang.org/dmd-osx.html#switch-i%5B) compiler option. As far as I know `dub`

Re: Diva - D Language Interface for Versioned Applications

2021-07-10 Thread Bastiaan Veelo via Digitalmars-d-announce
On Saturday, 10 July 2021 at 11:29:21 UTC, pineapple wrote: On Saturday, 10 July 2021 at 08:42:46 UTC, Bastiaan Veelo wrote: Could it be that you have overlooked D Version Manager? https://code.dlang.org/packages/dvm — Bastiaan. Oh, I hadn't picked up on that. That only manages DMD,

Re: Diva - D Language Interface for Versioned Applications

2021-07-10 Thread Bastiaan Veelo via Digitalmars-d-announce
On Friday, 9 July 2021 at 23:59:55 UTC, pineapple wrote: Basically, it's a version manager which currently supports DMD, LDC, and dub. It's rough, but maybe in some ways a little less rough than install.sh, at https://dlang.org/install.html https://github.com/pineapplemachine/diva Could

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-09 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 9 July 2021 at 21:13:02 UTC, rempas wrote: On Friday, 9 July 2021 at 20:54:21 UTC, Paul Backus wrote: On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote: I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the

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: Printing Tuple!(...)[] using for loop?

2021-07-02 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 2 July 2021 at 04:21:24 UTC, Kirill wrote: I have a `Tuple!(string, ..., string)[] data` If there are only strings in the tuple, it could be simplified by making it a static array of strings instead. The compile-time index issue would go away. —Bastiaan

Re: How to call stop from parallel foreach

2021-06-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 24 June 2021 at 20:56:26 UTC, Ali Çehreli wrote: On 6/24/21 1:33 PM, Bastiaan Veelo wrote: > distributes the load across all cores (but one). Last time I checked, the current thread would run tasks as well. Ali Indeed, thanks. — Bastiaan.

Re: How to call stop from parallel foreach

2021-06-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 24 June 2021 at 21:05:28 UTC, Bastiaan Veelo wrote: On Thursday, 24 June 2021 at 20:41:40 UTC, seany wrote: Is there any way to control the number of CPU cores used in parallelization ? E.g : take 3 cores for the first parallel foreach - and then for the second one, take 3 cores

Re: How to call stop from parallel foreach

2021-06-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 24 June 2021 at 20:41:40 UTC, seany wrote: On Thursday, 24 June 2021 at 20:33:00 UTC, Bastiaan Veelo wrote: By the way, nesting parallel `foreach` does not make much sense, as one level already distributes the load across all cores (but one). Additional parallelisation will

Re: How to call stop from parallel foreach

2021-06-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 24 June 2021 at 18:23:01 UTC, seany wrote: I have seen [this](https://forum.dlang.org/thread/akhbvvjgeaspmjntz...@forum.dlang.org). I can't call break form parallel foreach. Okey, Is there a way to easily call .stop() from such a case? Yes there is, but it won’t break the

Dub as tool chain installer

2021-06-18 Thread Bastiaan Veelo via Digitalmars-d-announce
On Friday, 18 June 2021 at 06:14:03 UTC, Martin Nowak wrote: Maybe we could recruit someone to replace the dated NSIS installer with a native msi installer. https://issues.dlang.org/show_bug.cgi?id=15375 https://en.wikipedia.org/wiki/List_of_installation_software#Windows Don't have much of a

Re: Financial Library

2021-06-13 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 13 June 2021 at 12:46:29 UTC, Financial Wiz wrote: What are some of the best Financial Libraries for D? I would like to be able to aggregate as much accurate information as possible. Thanks. I am not into financials, but these libs show up in a search:

Re: Inclusion of Parenthesis on Certain Functions

2021-06-13 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 13 June 2021 at 15:45:53 UTC, Justin Choi wrote: I've tried looking through the documentation but can't find an explanation for why you can use it without parenthesis. https://dlang.org/spec/function.html#optional-parenthesis (Some exceptions regarding delegates and function

Re: Dlang Setup Tutorials

2021-06-11 Thread Bastiaan Veelo via Digitalmars-d-announce
On Thursday, 10 June 2021 at 18:11:45 UTC, Igor wrote: Hi, I made my first few video tutorials and they are about how to setup DLang development environment on Windows and Linux. Hopefully it can help new people quickly setup everything for playing around with our beautiful language :).

Re: Release D 2.097.0

2021-06-07 Thread Bastiaan Veelo via Digitalmars-d-announce
On Saturday, 5 June 2021 at 13:00:05 UTC, evilrat wrote: Windows installer is broken. I have install target path excluded from Windows Defender anti virus checks, yet after the installation it only contains .bat files, uninstaller.exe, dmd2/windows/lib64 and lib32mscoff, but no bin and

Re: coreutils with D trials, wc, binary vs well formed utf

2021-05-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 24 May 2021 at 16:58:33 UTC, btiffin wrote: [...] Just bumped into https://dlang.org/blog/2020/01/28/wc-in-d-712-characters-without-a-single-branch/ [...] Is there a(n easy-ish) way to fix up that wc.d source in the blog to fallback to byte stream mode when a utf-8 reader fails

Re: Struct initialization extra comma - should it compile

2021-04-25 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 25 April 2021 at 13:39:54 UTC, JN wrote: struct Foo { int x, y, z; } void main() { Foo bar = Foo(1,); } This compiles without syntax errors, is this expected? Yes, the

Re: When should I use SortedRange.release?

2021-04-23 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 23 April 2021 at 21:34:39 UTC, Steven Schveighoffer wrote: `SortedRange` itself is kind of a kludge of "policy" that isn't fit for function. I use release to get the original data type out (via r.save.release), but that's about it. See my rant about it

Re: When should I use SortedRange.release?

2021-04-23 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 23 April 2021 at 18:35:25 UTC, Paul Backus wrote: On Friday, 23 April 2021 at 17:35:13 UTC, Bastiaan Veelo wrote: What happens when a range is released? What happens if a range is not released? What happens if a range is released more than once? And what does "controlled" imply

When should I use SortedRange.release?

2021-04-23 Thread Bastiaan Veelo via Digitalmars-d-learn
For reference, `SortedRange.release` is [documented](https://dlang.org/phobos/std_range.html#.SortedRange) as such: "Releases the controlled range and returns it." Wow thanks! I love functions that are named exactly as what they do ;-) Seriously though, I still don't know what it is that it

Re: Range Error

2021-04-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as `i < 0`.

Re: Example for Mir-Random fails

2021-04-03 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 3 April 2021 at 19:02:34 UTC, Brad wrote: I just do not know enough about the D libraries to figure out what is wrong. I know it is a case of type mismatch. The example appears on the Mir-Random page as listed under DUB: https://code.dlang.org/packages/mir-random [...] I

Re: C++/D class interop example crashes

2021-03-27 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 27 March 2021 at 15:09:20 UTC, Jan wrote: I just tried to get this example to work: https://dlang.org/spec/cpp_interface.html#using_d_classes_from_cpp It kept crashing for me with a 'privileged instruction' error when the function 'bar' was executed. Finally I removed the call to

Re: Contributing CDF bindings to Deimos

2021-03-25 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 25 March 2021 at 04:00:33 UTC, Chris Piker wrote: As an aside, software developers at NASA Goddard have now heard of D which is nice. They were pleased to see that it was supported by gcc. (Hat tip to the GDC team) That’s cool. I’d love to see NASA on

Re: Why are enums with base type string not considered strings?

2021-03-14 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 14 March 2021 at 16:09:39 UTC, Imperatorn wrote: On Sunday, 14 March 2021 at 10:42:17 UTC, wolframw wrote: enum BoolEnum : bool { TestBool = false } enum CharEnum : char { TestChar = 'A' } enum StringEnum : string { TestString = "Hello" } pragma(msg, isBoolean!BoolEnum);

  1   2   3   4   5   >