Re: Cannot implicitly convert expression of type const(string[]) to string[]

2021-01-08 Thread tsbockman via Digitalmars-d-learn
On Saturday, 9 January 2021 at 02:07:50 UTC, Ali Çehreli wrote: The destination is immutable(char)[]. No, it's not. string[] means immutable(char)[][] - note the second set of brackets. Even though the source is 'const ref', other.text is a copy of the slice object (the pointer and the

Re: Cannot implicitly convert expression of type const(string[]) to string[]

2021-01-08 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 9 January 2021 at 02:07:50 UTC, Ali Çehreli wrote: On 1/8/21 3:10 PM, tsbockman wrote: > On Friday, 8 January 2021 at 20:43:37 UTC, Andrey wrote: >> Hello, >> >>> struct Value >>> { >>> int value; >>> string data; >>> string[] text; The destination is

Re: Cannot implicitly convert expression of type const(string[]) to string[]

2021-01-08 Thread Ali Çehreli via Digitalmars-d-learn
On 1/8/21 3:10 PM, tsbockman wrote: > On Friday, 8 January 2021 at 20:43:37 UTC, Andrey wrote: >> Hello, >> >>> struct Value >>> { >>> int value; >>> string data; >>> string[] text; The destination is immutable(char)[]. The characters cannot be changed. We can still append but

Re: Cannot implicitly convert expression of type const(string[]) to string[]

2021-01-08 Thread tsbockman via Digitalmars-d-learn
On Friday, 8 January 2021 at 23:10:13 UTC, tsbockman wrote: 5) Tell the compiler that `other.text` may be used to mutate `row.text` by `const` from the `value` parameter of `test`. Do not do this unless that's really what you want! Oops, that should say: 5) Tell the compiler that

Re: Cannot implicitly convert expression of type const(string[]) to string[]

2021-01-08 Thread tsbockman via Digitalmars-d-learn
On Friday, 8 January 2021 at 20:43:37 UTC, Andrey wrote: Hello, struct Value { int value; string data; string[] text; } void test(const ref Value value) { Value other = void; other.text = value.text; } void main() { Value row; row.value = 10; row.data =

Re: Using a betterC dub package in ordinary D

2021-01-08 Thread Arjan via Digitalmars-d-learn
On Friday, 8 January 2021 at 20:19:59 UTC, Bastiaan Veelo wrote: Off topick, the original js implementation is documented to not generate results that are guaranteed to be correct. I could not find information on what the conditions are that cause deviations, and how large these then can be.

Re: Using a betterC dub package in ordinary D

2021-01-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 8 January 2021 at 20:19:59 UTC, Bastiaan Veelo wrote: On Friday, 8 January 2021 at 18:28:36 UTC, Ferhat Kurtulmuş wrote: On Friday, 8 January 2021 at 15:40:12 UTC, Bastiaan Veelo wrote: Hi, When I use earcutd [1] in an ordinary D project, I get a link error for the

Re: Cannot implicitly convert expression of type const(string[]) to string[]

2021-01-08 Thread kdevel via Digitalmars-d-learn
On Friday, 8 January 2021 at 20:43:37 UTC, Andrey wrote: [...] 2. Or how to pass "row" correctly? Drop the "const" before "ref".

Cannot implicitly convert expression of type const(string[]) to string[]

2021-01-08 Thread Andrey via Digitalmars-d-learn
Hello, struct Value { int value; string data; string[] text; } void test(const ref Value value) { Value other = void; other.text = value.text; } void main() { Value row; row.value = 10; row.data = "ggg"; test(row); } I want to pass variable "row"

Re: Using a betterC dub package in ordinary D

2021-01-08 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 8 January 2021 at 18:28:36 UTC, Ferhat Kurtulmuş wrote: On Friday, 8 January 2021 at 15:40:12 UTC, Bastiaan Veelo wrote: Hi, When I use earcutd [1] in an ordinary D project, I get a link error for the __D7earcutd12__ModuleInfoZ symbol. [...] Dear Bastiaan, I am not an expert in

msgpack-d: package import; 64 bit

2021-01-08 Thread kdevel via Digitalmars-d-learn
Here a condensed version of the problem I encountered after updating to msgpack-d 1.0.3 and not merging a local patch of this [1] line: ```sub.d module sub; import l2; void foo () { import std.stdio: writeln; bar(); auto fn = !string; writeln (`isDir fn ptr = `, fn); } unittest {

Re: Using a betterC dub package in ordinary D

2021-01-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 8 January 2021 at 18:28:36 UTC, Ferhat Kurtulmuş wrote: On Friday, 8 January 2021 at 15:40:12 UTC, Bastiaan Veelo wrote: Hi, When I use earcutd [1] in an ordinary D project, I get a link error for the __D7earcutd12__ModuleInfoZ symbol. This is because the earcutd dub.json has

Re: Using a betterC dub package in ordinary D

2021-01-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 8 January 2021 at 15:40:12 UTC, Bastiaan Veelo wrote: Hi, When I use earcutd [1] in an ordinary D project, I get a link error for the __D7earcutd12__ModuleInfoZ symbol. This is because the earcutd dub.json has `"dflags": ["-betterC"]`. I think this is in error, my understanding of

Using a betterC dub package in ordinary D

2021-01-08 Thread Bastiaan Veelo via Digitalmars-d-learn
Hi, When I use earcutd [1] in an ordinary D project, I get a link error for the __D7earcutd12__ModuleInfoZ symbol. This is because the earcutd dub.json has `"dflags": ["-betterC"]`. I think this is in error, my understanding of betterC code is that it can be compiled with "-betterC", but

Re: Socket handle leak and active handle warning with Vibe-D

2021-01-08 Thread aberba via Digitalmars-d-learn
On Friday, 1 January 2021 at 22:07:28 UTC, Selim Ozel wrote: [2] https://github.com/SelimOzel/vibe_noLeaks I don't see anything abnormal in this code though. Will trying it later today myself. Could you show the actual socket code causing that leak?

Re: DConf talk : Exceptions will disappear in the future?

2021-01-08 Thread Tony via Digitalmars-d-learn
On Tuesday, 5 January 2021 at 18:42:42 UTC, Marvin wrote: On Monday, 4 January 2021 at 15:39:50 UTC, ludo456 wrote: Listening to the first visioconf of the Dconf 2020, titled Destroy All Memory Corruption, (https://www.youtube.com/watch?v=XQHAIglE9CU) Walter talks about not using exceptions

Re: Socket handle leak and active handle warning with Vibe-D

2021-01-08 Thread aberba via Digitalmars-d-learn
On Tuesday, 5 January 2021 at 21:12:01 UTC, Selim Ozel wrote: On Monday, 4 January 2021 at 17:17:10 UTC, Steven Schveighoffer wrote: On 1/2/21 12:52 PM, Selim Ozel wrote: After logging into to 127.0.0.1 for a single time in my browser, if I do a ctrl+c it still leaks two socket handles.