On Monday, 8 August 2022 at 18:49:26 UTC, Ali Çehreli wrote:
On 8/6/22 18:22, pascal111 wrote:
> [...]
To add to what has already mentioned,
- chain can be used on ranges that are of different element
types
[...]
Thanks for explanation!
On Monday, 8 August 2022 at 13:26:49 UTC, frame wrote:
On Monday, 8 August 2022 at 01:05:40 UTC, pascal111 wrote:
In next program, I used "insertInPlace", not "~" nor "chain",
should I use "~" or it's the same as "insertInPlace"?
https://github.com/pascal111-fra/D/blob/main/coco.d
As you ma
On Monday, 8 August 2022 at 20:36:34 UTC, Steven Schveighoffer
wrote:
[...]
shared gives you a sense that the language is helping you
prevent problems. Again, if C isn't playing ball, this is a lie.
The C side is playing ball, by whatever rules the C library
chooses.
`shared` (with `-previe
On Monday, 8 August 2022 at 19:47:35 UTC, Sergey wrote:
On Sunday, 7 August 2022 at 23:48:22 UTC, pascal111 wrote:
[...]
I think it is possible to find framework to solve the issues in
D..
my guess is based on information from the project ArabiaWeather
https://dlang.org/orgs-using-d.html
T
On 8/8/22 4:04 PM, ag0aep6g wrote:
On Monday, 8 August 2022 at 19:33:14 UTC, Steven Schveighoffer wrote:
There's nothing clever. If you want to access C globals, you should
use `__gshared`, because that's what it is. Using `shared`, isn't
going to save you at all.
Yes, using `shared` does sav
On Monday, 8 August 2022 at 19:33:14 UTC, Steven Schveighoffer
wrote:
There's nothing clever. If you want to access C globals, you
should use `__gshared`, because that's what it is. Using
`shared`, isn't going to save you at all.
Yes, using `shared` does save you.
C might not have a `shared`
On Sunday, 7 August 2022 at 23:48:22 UTC, pascal111 wrote:
I have no idea about GUI or Rad programming in D; it's not its
time, but I'm curious to know if D is fine supporting for
Arabic language in the GUI applications or we will have some
issues like I met - in my experience - in Free Pascal.
On 8/8/22 10:54 AM, ag0aep6g wrote:
On Monday, 8 August 2022 at 14:29:43 UTC, Steven Schveighoffer wrote:
C has no notion of shared, so it's not the right type. Putting
`shared` on it is kind of lying, and can lead to trouble. Better to be
explicit about what it is.
Nonsense. Putting `shared`
On Monday, 8 August 2022 at 17:45:03 UTC, bauss wrote:
On Monday, 8 August 2022 at 13:55:02 UTC, ag0aep6g wrote:
auto x = s.x;
```
Your problem is here and not because it was __gshared.
You're copying the value and obviously it can be changed in the
meantime, that's common sense.
On 8/6/22 18:22, pascal111 wrote:
> Why we use "chain" while we have "~":
>
> '''D
> int[] x=[1,2,3];
> int[] y=[4,5,6];
>
> auto z=chain(x,y);
> auto j=x~y;
> '''
To add to what has already mentioned,
- chain can be used on ranges that are of different element types
- as usual, some of the ran
On Monday, 8 August 2022 at 17:45:03 UTC, bauss wrote:
On Monday, 8 August 2022 at 13:55:02 UTC, ag0aep6g wrote:
auto x = s.x;
[...]
Your problem is here and not because it was __gshared.
You're copying the value and obviously it can be changed in the
meantime, that's common sense.
On Monday, 8 August 2022 at 13:55:02 UTC, ag0aep6g wrote:
auto x = s.x;
```
Your problem is here and not because it was __gshared.
You're copying the value and obviously it can be changed in the
meantime, that's common sense.
You shouldn't use it like that. You should access s.x di
Thank you all for the info! I'll try to find another way to do it
as it is not possible
to match the exact behavior I want! Have a great day everyone!
On Monday, 8 August 2022 at 14:29:43 UTC, Steven Schveighoffer
wrote:
C has no notion of shared, so it's not the right type. Putting
`shared` on it is kind of lying, and can lead to trouble.
Better to be explicit about what it is.
Nonsense. Putting `shared` on a shared variable is not "lying".
On Monday, 8 August 2022 at 12:46:48 UTC, bauss wrote:
On Monday, 8 August 2022 at 12:02:02 UTC, Dom Disc wrote:
```D
pure @nogc @safe BigInt opAssign(T : BigInt)(T x);
```
This will only be included in the object file if used.
```D
pure @nogc @safe BigInt opAssign(BigInt x);
```
This wil
On 8/8/22 10:12 AM, ag0aep6g wrote:
On Monday, 8 August 2022 at 13:31:04 UTC, Steven Schveighoffer wrote:
On 8/8/22 6:17 AM, ag0aep6g wrote:
[...]
Never ever use `__gshared` ever. It's a glaring safety hole. Use
`shared` instead.
If you are interfacing with C, you need __gshared. But yeah, y
On Monday, 8 August 2022 at 13:31:04 UTC, Steven Schveighoffer
wrote:
On 8/8/22 6:17 AM, ag0aep6g wrote:
[...]
Never ever use `__gshared` ever. It's a glaring safety hole.
Use `shared` instead.
If you are interfacing with C, you need __gshared. But yeah,
you should use shared in this case.
Here is another one that uses nested templates:
import std.stdio;
template TestArray(ulong element_n) {
struct TestArrayImpl(Type) {
int[element_n] elements;
this(ulong number) {
pragma(msg, "The type is: ", Type);
writeln("Constructing with ", number);
}
}
auto m
On Monday, 8 August 2022 at 10:17:57 UTC, ag0aep6g wrote:
By the way, is there some resource that recommends `__gshared`
over `shared`? It seems that many newbies reach for `__gshared`
first for some reason.
Would be also good if the specs would tell more about those
"guards":
Unlike the s
On 8/8/22 00:14, vc wrote:
> i will like to hear thoughts even if it works
> for me
__gshared would work as well but I would consider std.concurrency first.
Just a simple example:
import std.stdio;
import std.concurrency;
import core.thread;
struct Result {
int value;
}
struct Done {
}
v
On Monday, 8 August 2022 at 12:45:20 UTC, bauss wrote:
On Monday, 8 August 2022 at 10:17:57 UTC, ag0aep6g wrote:
Never ever use `__gshared` ever.
[...]
To sum it up:
Single-write/Single-read?
__gshared
Single-write/Multi-read?
__gshared
Multi-write/Single-read?
shared
Multi-write/Multi-re
On 8/8/22 9:36 AM, Steven Schveighoffer wrote:
On 8/8/22 1:38 AM, rempas wrote:
In the following struct (as an example, not real code):
```
struct TestArray(ulong element_n) {
int[element_n] elements;
this(string type)(ulong number) {
pragma(msg, "The type is: " ~ typeof(type).strin
On 8/8/22 1:38 AM, rempas wrote:
In the following struct (as an example, not real code):
```
struct TestArray(ulong element_n) {
int[element_n] elements;
this(string type)(ulong number) {
pragma(msg, "The type is: " ~ typeof(type).stringof);
}
}
```
I want to create it and be abl
On 8/7/22 22:38, rempas wrote:
> I want to create it and be able to successfully initialize the template
> parameters
> of the constructor but until now, I wasn't able to find a way to
> successfully do
> that.
The following method uses a convenience function but it's not really needed:
import
On 8/8/22 8:02 AM, Dom Disc wrote:
Hello.
I found in the documentation functions declared like this:
```D
pure @nogc @safe BigInt opAssign(T : BigInt)(T x);
```
What is the difference to declaring it like:
```D
pure @nogc @safe BigInt opAssign(BigInt x);
```
To me the first declaration seems
On 8/8/22 6:17 AM, ag0aep6g wrote:
On Monday, 8 August 2022 at 07:14:33 UTC, vc wrote:
it seems change it to working is working
```d
__gshared bool zeus;
```
but as I'm new in to D, i will like to hear thoughts even if it works
for me
Never ever use `__gshared` ever. It's a glaring safety
On Monday, 8 August 2022 at 00:23:52 UTC, pascal111 wrote:
On Monday, 8 August 2022 at 00:20:53 UTC, pascal111 wrote:
On Monday, 8 August 2022 at 00:12:07 UTC, Emanuele Torre wrote:
[...]
So, the reason is the toolkit. I guessed D has specific
library for GUI, and with that I judged D as whole
On Monday, 8 August 2022 at 01:05:40 UTC, pascal111 wrote:
In next program, I used "insertInPlace", not "~" nor "chain",
should I use "~" or it's the same as "insertInPlace"?
https://github.com/pascal111-fra/D/blob/main/coco.d
As you may noticed, `insertInPlace` has another purpose than just
On Monday, 8 August 2022 at 05:38:31 UTC, rempas wrote:
In the following struct (as an example, not real code):
```
struct TestArray(ulong element_n) {
int[element_n] elements;
this(string type)(ulong number) {
pragma(msg, "The type is: " ~ typeof(type).stringof);
}
}
```
I want to c
On Monday, 8 August 2022 at 12:26:50 UTC, rempas wrote:
On Monday, 8 August 2022 at 11:03:21 UTC, Dom Disc wrote:
You should first describe what you want to do clearly.
On Monday, 8 August 2022 at 12:02:02 UTC, Dom Disc wrote:
```D
pure @nogc @safe BigInt opAssign(T : BigInt)(T x);
```
This will only be included in the object file if used.
What is the difference to declaring it like:
```D
pure @nogc @safe BigInt opAssign(BigInt x);
```
This will always
On Monday, 8 August 2022 at 10:17:57 UTC, ag0aep6g wrote:
Never ever use `__gshared` ever.
I don't agree with this entirely, it just depends on how you use
it. In general you should go with shared, but __gshared does have
its places. It's only problematic when it can be changed from
multipl
On Monday, 8 August 2022 at 11:35:48 UTC, pascal111 wrote:
The output of next code is the same to extent that we feel that
there's no difference between "only" and "[]", so what "only"
added here?:
'''D
[1,2,3].writeln;
only(1,2,3).writeln;
'''
output:
[1, 2, 3]
[1, 2, 3]
`only(1,2,3)` do
On Monday, 8 August 2022 at 11:03:21 UTC, Dom Disc wrote:
But if you only want to know the type of the parameter, you can
do this:
```D
struct TestArray(ulong element_n) {
int[element_n] elements;
this(type)(type number)
{
pragma(msg, "The type is: " ~ type.stringof);
}
}
```
U
On Monday, 8 August 2022 at 08:27:49 UTC, bauss wrote:
Yeah I think the only template argument you can have for
constructors are `this` which will refer to things like the
class that inherited the current class etc. not sure what else,
but you can't really pass anything to it yourself unfortu
Hello.
I found in the documentation functions declared like this:
```D
pure @nogc @safe BigInt opAssign(T : BigInt)(T x);
```
What is the difference to declaring it like:
```D
pure @nogc @safe BigInt opAssign(BigInt x);
```
To me the first declaration seems to be unnecessarily bloated, so
I a
The output of next code is the same to extent that we feel that
there's no difference between "only" and "[]", so what "only"
added here?:
'''D
[1,2,3].writeln;
only(1,2,3).writeln;
'''
output:
[1, 2, 3]
[1, 2, 3]
And then you can instantiate it with
```D
auto val = TestArray!10(ubyte(60)); // if you want type to be
ubyte
```
On Monday, 8 August 2022 at 06:58:42 UTC, bauss wrote:
On Monday, 8 August 2022 at 05:38:31 UTC, rempas wrote:
In the following struct (as an example, not real code):
```
struct TestArray(ulong element_n) {
int[element_n] elements;
this(string type)(ulong number) {
pragma(msg, "The typ
On Monday, 8 August 2022 at 07:14:33 UTC, vc wrote:
it seems change it to working is working
```d
__gshared bool zeus;
```
but as I'm new in to D, i will like to hear thoughts even if it
works for me
Never ever use `__gshared` ever. It's a glaring safety hole. Use
`shared` instead.
If y
On Monday, 8 August 2022 at 07:37:16 UTC, rempas wrote:
Thank you for all the great info! Unfortunately, while there is
no problem in this example, this will
not do for my real code as I need to have the argument in the
constructor. Alternative, I have to
change the design of the program comp
On Monday, 8 August 2022 at 06:58:42 UTC, bauss wrote:
```
this(string type)(ulong number) {
```
You cannot do this.
Instead your type should look like this:
First let's change it up a little bit.
```
struct TestArray(ulong element_n, string type) {
int[element_n] elements;
this(ulong n
On Monday, 8 August 2022 at 02:49:06 UTC, Steven Schveighoffer
wrote:
On 8/7/22 9:36 PM, vc wrote:
Hello, i have the following code, the flora contains a boolean
zeus
in the DerivedThread the boolean zeus was set to true; but
when i'm trying to access it
outside the thread in main it returns m
On Monday, 8 August 2022 at 00:11:33 UTC, pascal111 wrote:
I don't have specific code but it was a general notice. Take
Python as in example, the same program in Python doesn't cost
much code as D code, and of course by putting in accounts that
that I assume that there are some special tasks
On Monday, 8 August 2022 at 05:38:31 UTC, rempas wrote:
In the following struct (as an example, not real code):
```
struct TestArray(ulong element_n) {
int[element_n] elements;
this(string type)(ulong number) {
pragma(msg, "The type is: " ~ typeof(type).stringof);
}
}
```
I want to c
45 matches
Mail list logo