On 25/10/2022 5:17 PM, Siarhei Siamashka wrote:
Wow, I didn't expect anything like this and just thought that the
nightmares of handling 8-bit codepages for non-English languages ceased
to exist nowadays. Too bad. What are the best practices to deal with
Turkish text in D language?
std.uni
On Monday, 24 October 2022 at 21:52:18 UTC, Ali Çehreli wrote:
On 10/24/22 14:26, Per Nordlöw wrote:
[...]
Another option is to use range functions where front() returns
a Tuple. We have an esoteric feature where a tuple expands
automatically in foreach loops:
import std.typecons : tuple;
On Monday, 24 October 2022 at 20:43:45 UTC, ryuukk_ wrote:
I wish we could do ``version(DebugFast | Release)``
Moreover, I've been using, for instance,
```d
version(D_Coverage) {} else pragma(inline, true);
void foo() {}
```
to get correct coverage inclusion of `foo()`. Is this still neeed?
I'm having problems compiling my thing into an executable that
doesn't require ldc's phobos/druntime .so's. I want to distribute
it in a form where it's okay if
`/usr/lib/libphobos2-ldc-shared.so.100` and friends don't exist.
`--static` seems to do the trick in that the compiled file is no
On Sunday, 23 October 2022 at 20:12:46 UTC, Hipreme wrote:
This will greatly reduce the number of import and dependencies
you need if you ever need to distribute a library.
Could you elaborate more on the benefit? Does it reduce
compilation time for dependency? If so then how much?
I have the following types (simplified version of my code):
```d
struct A
{
int[] i;
}
struct B
{
A[] a = [A.init];
}
```
This code:
```d
auto b1 = B.init;
b1.a[0].i ~= 1;
b1.a ~= A.init;
b1.a[0].i ~= 11;
b1.a[1].i ~= 12;
b1.writeln;
auto b2 = B();
ldc2 -link-defaultlib-shared=false or something like that
On Tuesday, 25 October 2022 at 10:55:33 UTC, Kagamin wrote:
ldc2 -link-defaultlib-shared=false or something like that
Thanks.
On Tuesday, 25 October 2022 at 14:53:50 UTC, Adam D Ruppe wrote:
But just don't do this. Only basic values and immutable strings
are good to initialize this way. With the array or class
objects, you're liable to get some shared thing.
If you change this to be initialized in a constructor
On Tuesday, 25 October 2022 at 13:51:30 UTC, Andrey Zherikov
wrote:
A[] a = [A.init];
This is a problem - this is referring to a static array instance,
shared across all copies of B. You almost certainly don't want
this.
That B.a[0] is the *same object* across different
On 10/25/22 07:53, Adam D Ruppe wrote:
> On Tuesday, 25 October 2022 at 13:51:30 UTC, Andrey Zherikov wrote:
>> A[] a = [A.init];
>
> This is a problem - this is referring to a static array instance, shared
> across all copies of B. You almost certainly don't want this.
Agreed. It should be
On Tuesday, 25 October 2022 at 08:14:26 UTC, Per Nordlöw wrote:
On Monday, 24 October 2022 at 20:43:45 UTC, ryuukk_ wrote:
I wish we could do ``version(DebugFast | Release)``
Moreover, I've been using, for instance,
```d
version(D_Coverage) {} else pragma(inline, true);
void foo() {}
```
to
On Tuesday, 25 October 2022 at 14:53:50 UTC, Adam D Ruppe wrote:
On Tuesday, 25 October 2022 at 13:51:30 UTC, Andrey Zherikov
wrote:
A[] a = [A.init];
This is a problem - this is referring to a static array
instance, shared across all copies of B. You almost certainly
don't want this.
On 10/25/22 08:50, Andrey Zherikov wrote:
> I'd like to tune default ctor but structs can't have custom one.
> Adding a ctor with parameter seems a hack to me
There is static opCall, which may be seen as a hack as well. :) The
following all print the same thing now:
import std.stdio;
struct
On Tuesday, 25 October 2022 at 17:18:35 UTC, Paul Backus wrote:
It's not a bug. They're pointing to the exact same instance of
`A` in memory:
I don't understand? So I don't understand why it causes problems
with dynamic arrays! So why is there nothing wrong with the
static array in the
On 10/25/22 11:01, Ali Çehreli wrote:
> static arrays don't have .ptr to point
> to any member.
Why do I say incorrect things like that? :) Of course static arrays have
.ptr as well but that always point to their own body of N elements. They
own their elements... I move away from the keyboard
On Tuesday, 25 October 2022 at 13:51:30 UTC, Andrey Zherikov
wrote:
Does the second piece of code shows a bug or my expectation is
not correct (and why if so)?
This is a bug:
```d
void main()
{
struct B
{
struct A
{
int i = 10;
}
A[] a = [A.init];
}
B[2] b;
On Tuesday, 25 October 2022 at 16:52:48 UTC, Salih Dincer wrote:
On Tuesday, 25 October 2022 at 13:51:30 UTC, Andrey Zherikov
wrote:
Does the second piece of code shows a bug or my expectation is
not correct (and why if so)?
This is a bug:
```d
void main()
{
struct B
{
struct A
{
On Tuesday, 25 October 2022 at 08:14:26 UTC, Per Nordlöw wrote:
On Monday, 24 October 2022 at 20:43:45 UTC, ryuukk_ wrote:
I wish we could do ``version(DebugFast | Release)``
Moreover, I've been using, for instance,
```d
version(D_Coverage) {} else pragma(inline, true);
void foo() {}
```
to
On 10/25/22 2:03 PM, Ali Çehreli wrote:
On 10/25/22 11:01, Ali Çehreli wrote:
> static arrays don't have .ptr to point
> to any member.
Why do I say incorrect things like that? :) Of course static arrays have
.ptr as well but that always point to their own body of N elements. They
own
On 10/25/22 10:54, Salih Dincer wrote:
> So I don't understand why it causes problems with
> dynamic arrays! So why is there nothing wrong with the static array in
> the example below?
The same rules as other uses of dynamic arrays...
> //A[] a = [A.init];/*
In that case, there is a
On Wednesday, 26 October 2022 at 00:44:45 UTC, H. S. Teoh wrote:
If you'll excuse some ASCII art, here's the situation you have:
STACK GLOBAL DATA
x[0] {
Y[] y; -+> [ Y.init ]
} |
x[1] { |
On Tuesday, 25 October 2022 at 20:36:28 UTC, matheus wrote:
On
int[] a = [1];
int[] b = a.dup;
assert([0] !is [0]); // different memory
```
This is interesting, I understand the point of "reference vs
copy", and I'm OK with this design choice of, but I wonder in
the case of newcomers if
On Wednesday, 26 October 2022 at 05:17:06 UTC, rikki cattermole
wrote:
if you are able to ignore that Unicode is a thing, I'd
recommend it. It is complicated, as we humans are very
complicated ;)
I can't ignore Unicode, because I frequently have to deal with
Cyrillic alphabet ;) Also Unicode
typeof(screen.output.findSplit("")) s;
Perfect. That was the "essence" of my question. But thanks to
Ali, I don't have to use such esoteric syntax. D is a wonderful
language, but I seem to shoot myself in the foot :)
On 10/25/22 19:25, Salih Dincer wrote:
> with static in main():
If 'static' makes a difference on your side as well, it is your turn to
create a bug report. :) (Last time you discovered a bug, I was too quick
to report it. :/)
Ali
On 10/25/22 6:07 PM, WhatMeWorry wrote:
I'm naturally getting a undefined identifier `s` error in the return.
Is there some way to refactor my code? I tried to declare s outside of
the else brackets like:
auto screen = executeShell(cmdLine);
auto s;
...
{
s =
On Wednesday, 26 October 2022 at 02:34:24 UTC, Ali Çehreli wrote:
On 10/25/22 19:25, Salih Dincer wrote:
> with static in main():
If 'static' makes a difference on your side as well, it is your
turn to create a bug report. :) (Last time you discovered a
bug, I was too quick to report it. :/)
On 26/10/2022 6:06 PM, Siarhei Siamashka wrote:
Should we ignore the `"D should strive to be correct, rather than fast"`
comment from bauss for now? Or some actions can be taken to improve the
current situation?
Bauss is correct.
It should be implemented but it does not need to be fast.
But
On Wed, Oct 26, 2022 at 12:16:55AM +, Salih Dincer via Digitalmars-d-learn
wrote:
[...]
> I've known D for more than 10 years, but the topic we're talking about
> still seems strange to me. The explanations given are not enough for
> me, I'm sorry.
>
> Can anyone tell me what happens when I
On 10/25/22 17:16, Salih Dincer wrote:
> Excuse me, but they still write in purple prose about dynamic
> array literature here!
I've heard positive things about D's arrays from people who use D in
production. Especially slices...
> I've known D for more than 10 years, but the topic we're
On Tuesday, 25 October 2022 at 06:32:00 UTC, rikki cattermole
wrote:
On 25/10/2022 5:17 PM, Siarhei Siamashka wrote:
What are the best practices to deal with Turkish text in D
language?
std.uni doesn't support it.
OK, I'm not specifically interested in this personally and I even
would be
I'm naturally getting a undefined identifier `s` error in the
return. Is there some way to refactor my code? I tried to
declare s outside of the else brackets like:
auto screen = executeShell(cmdLine);
auto s;
...
{
s = screen.output.findSplit("REG_SZ");
}
but that doesn't compile
On 10/25/22 13:36, matheus wrote:
> On Tuesday, 25 October 2022 at 20:12:25 UTC, Paul Backus wrote:
>> Static arrays are value types.
What that means is, when we say float[3], there are just 3 floats
without any overhead.
>> Dynamic arrays are reference types.
That phrase can be confusing
On 10/25/22 15:07, WhatMeWorry wrote:
> auto screen = executeShell(cmdLine);
> auto s;
That can't work because there is no information to infer the type of
's'. Judging from the return type of getPath, perhaps it's string[]:
string[] s;
This is the question we should answer first: What
On 10/25/22 13:12, Paul Backus wrote:
> In order to create a copy of a static array
Although .dup works for static arrays as well, you meant "dynamic array"
and everyones knows it. :)
> with its own block of
> memory, separate from the original, you have to use the built-in `.dup`
> method:
On Tuesday, 25 October 2022 at 20:12:25 UTC, Paul Backus wrote:
On Tuesday, 25 October 2022 at 17:54:16 UTC, Salih Dincer wrote:
On Tuesday, 25 October 2022 at 17:18:35 UTC, Paul Backus wrote:
It's not a bug. They're pointing to the exact same instance
of `A` in memory:
I don't understand?
On Tuesday, 25 October 2022 at 20:27:18 UTC, Ali Çehreli wrote:
On 10/25/22 13:12, Paul Backus wrote:
> In order to create a copy of a static array
Although .dup works for static arrays as well, you meant
"dynamic array" and everyones knows it. :)
Yes; thank you for the correction. :)
On Tuesday, 25 October 2022 at 17:54:16 UTC, Salih Dincer wrote:
On Tuesday, 25 October 2022 at 17:18:35 UTC, Paul Backus wrote:
It's not a bug. They're pointing to the exact same instance of
`A` in memory:
I don't understand? So I don't understand why it causes
problems with dynamic
On 10/25/22 11:23, Steven Schveighoffer wrote:
>> Why do I say incorrect things like that? :)
> You were right actually.
As always! Now I'm confused. :o)
Ali
40 matches
Mail list logo