On Saturday, 30 March 2024 at 03:25:02 UTC, matheus wrote:
Interesting!
Matheus.
Yes, it's just a small modification.
On Friday, 29 March 2024 at 22:50:53 UTC, curiousprogramma08
wrote:
you can use openD.
On Monday, 5 February 2024 at 21:12:58 UTC, Gary Chike wrote:
I hope all is well with everyone. I have come to an impasse.
What is the best way to unpack a tuple into multiple variables
in D similar to this Python code? Thank you!
Officially, there should be an unpacking solution, like
On Sunday, 28 January 2024 at 06:34:13 UTC, Siarhei Siamashka
wrote:
The explicit conversion `.length.to!int` has an extra benefit
I rarely use numbers over one million.
But do I have to consider numbers over `4 billion` every day?
On Friday, 26 January 2024 at 14:46:08 UTC, Emmanuel Danso Nyarko
wrote:
Yes, this is a project currently in progress. Vector was only
working for windows but we have it working on linux but it's
not yet ready to be used that's why you could only use it from
a standalone fork.
On Thursday, 25 January 2024 at 08:46:34 UTC, Renato wrote:
```d
void main() {
Person p = { "Joe", "j...@ab.com", 30};
writeln(p);
}
```
I just tested it and it works. It's `great`!
On Monday, 22 January 2024 at 15:51:37 UTC, zjh wrote:
I spent `too much time` on D.
And some of the inherent `drawbacks` of `C++` are too hateful.
On Monday, 22 January 2024 at 15:47:23 UTC, bachmeier wrote:
Sounds like you should be using C++. Why are you here?
I spent `too much time` on D.
On Monday, 22 January 2024 at 15:14:32 UTC, Bkoie wrote:
D is totally different from C++ in D you usually you wont
construct the struct directly use alias as.
Stop being `unconventional` and quickly copy their `good things`.
Otherwise, the `development speed` of the D language is really
On Monday, 22 January 2024 at 15:33:01 UTC, ryuukk_ wrote:
it only took me 1 project to never want to touch C++ again..
D language used to have no `copy constructor`, isn't it now added
in again?
You have to admit the good aspects of `C++`.
You should take a look at the `latest C++`. C++
On Monday, 22 January 2024 at 08:54:54 UTC, zjh wrote:
```d
struct Person {
string name, email;
ulong age;
}
Person a{"n","email",33};
```
C++ can achieve ultimate `simplicity` without violating `DRY`,
And here, D violates the `DRY` principle!
Moreover, as the `package level, module
On Monday, 22 January 2024 at 11:31:11 UTC, zjh wrote:
D language violates integrity.
Because D has no `class level` limit.
These are all not `serious states`.
It seems that D language is not `professional`.
On Monday, 22 January 2024 at 08:27:36 UTC, Joel wrote:
```d
import std;
struct Person {
string name, email;
ulong age;
auto withName(string name) { this.name=name; return this; }
auto withEmail(string email) { this.email=email; return
this; }
auto withAge(ulong age) {
On Sunday, 21 January 2024 at 18:38:42 UTC, atzensepp wrote:
What if you add more lines to the file. Does it crash then
later?
It's a problem with `vectors`. `vector!string` has a problem , I
just use 'string []', and it's OK.
The `vector` is unstable, possibly because the `later data`
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote:
```d
void toV(string a,ref vector!string b){
auto f=File(a,"r");
while(!f.eof()){
string l=strip(f.readln());push(b,l);
}
Qwk(b);
}//
```
There is an issue with the `vector` here, I don't know why the
subsequent
On Friday, 19 January 2024 at 02:13:08 UTC, zjh wrote:
...
`Compile command`:
```d
dmd -i cy2.d dparse.lib
```
need libdparse lib.
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote:
```d
import std.stdio, std.range,std.file;
import std.string:strip;
import dparse.ast;
import dparse.lexer;
import dparse.parser : parseModule;
import dparse.rollback_allocator : RollbackAllocator;
import core.stdcpp.vector;
import
On Thursday, 18 January 2024 at 07:44:00 UTC, Jonathan M Davis
wrote:
```d
auto a = foo();
or
auto len = arr.length;
Thank you for your reply, just to use `auto`.
On Thursday, 18 January 2024 at 04:30:33 UTC, Jonathan M Davis
wrote:
but for a lot of code, using auto and size_t makes it
so that you don't need to use int, and it would be a big
problem in general if the language made length int.
It's hard to imagine that an `'int'` needs to be replaced
On Thursday, 18 January 2024 at 04:24:18 UTC, zjh wrote:
```d
class V : ASTVisitor
{
Vector!string f=[];
alias visit = ASTVisitor.visit;
override void visit(const FunctionDeclaration decl)
{
writeln(' '.repeat(indentLevel * 4), decl.name.text);
On Thursday, 18 January 2024 at 04:20:12 UTC, zjh wrote:
foreach(e;d){
```d
foreach(e;d){//.0
string b=e;
string m=readText(b);ff(m,b);
}
```
or here `.0`? why crash?
On Thursday, 18 January 2024 at 03:53:09 UTC, Steven
Schveighoffer wrote:
Are you sure this is what you are wanting to do?
-Steve
```d
void gg(string a){
Vector!string d=[];toV(a,d);//File to Vector
print(d);//3,OK
foreach(e;d){
string b=e;//.1
string
On Thursday, 18 January 2024 at 03:11:57 UTC, zjh wrote:
```d
string b=d[i];//the 3th:vector.d
//`+Object`,crashes!
```
```d
//d[i]==>e
string b=e;
```
in the foreach.
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote:
Why can `b` still affect `e` here? Isn't `b` copied?
here foreach crashes.
Starting from the `third one`, it crashes. It's clearly
`vector.d`, but the result is`+Object`.
```d
string b=d[i];//the 3th:vector.d
//`+Object`,crashes!
```
```d
import dparse.ast;
import dparse.lexer;
import dparse.parser : parseModule;
import dparse.rollback_allocator : RollbackAllocator;
import core.stdcpp.vector;
import core.stdcpp.string;
Vector!string d=[];toV(a,d);
print(d);//3
foreach(e;d){
string b=d[i];
string
On Friday, 1 December 2023 at 13:02:06 UTC, Dom DiSc wrote:
```d
S Fun(){ return { 5, 2 }; }
```
This IS an initialization and the type is known. Requiring the
repetition of the type is also here annoying.
Right.
The `{}` initialization method in C++ is very useful,I like it
very much.
On Wednesday, 29 November 2023 at 16:38:36 UTC, Dom DiSc wrote:
```d
struct S { int a; int b; }
S2 fun3() { return S2( 5, 2 ); }
```
Here,`S2( 5, 2 );` violeit `DRY` principle.
On Friday, 16 June 2023 at 01:54:22 UTC, Jonathan M Davis wrote:
```d
doSomething();
scope(exit) undoSomething();
```
Thank you for your `wonderful summary`. It's worth saving the
link.
On Friday, 16 June 2023 at 01:45:35 UTC, CM wrote:
```d
auto m = Man();
assert(m.name == defaultName);
```
Do note that one cannot simultaneously have a constructor and a
static opCall, even if their parameters differ.
Thank you for your reply. This should be enough, as this type of
RAII
On Friday, 16 June 2023 at 01:00:05 UTC, Steven Schveighoffer
wrote:
B b = B.make(); // call factory function
-Steve
Thank you for your tip.
If could simplify it a bit more, it would be even better. It's
really uncomfortable without `this()`.
On Friday, 16 June 2023 at 00:35:48 UTC, Steven Schveighoffer
wrote:
Instead, you can use factory functions to initialize.
-Steve
How can `factory functions` be used to achieve effects similar to
`'RAII'`?
Thank you.
On Friday, 16 June 2023 at 00:35:48 UTC, Steven Schveighoffer
wrote:
But there is no way in D to have e.g.:
```d
B b; // runs a constructor
```
-Steve
As a `C++` user, it is very terrible to simplify `RAII` without
such a method. Why must `this()` be disabled? Can't there be a
On Thursday, 15 June 2023 at 21:48:10 UTC, Ali Çehreli wrote:
I have difficulty understanding the question. I think the
nested structs, extern(C), static members, etc. confuse me. I
am assuming they are not related to this question.
Ali
I used the `class` to call the`
On Thursday, 15 June 2023 at 21:48:10 UTC, Ali Çehreli wrote:
And this is by design: In D, we rename the type and be done
with it. In C++, one needs to rename a number of functions as
well.
Ali
```d
static int e=40;
struct B{
int m;
this(int i){
```d
import core.stdc.stdio;
struct A{
static int e=40;
struct B{
int m;
this(int i){
printf("%i",e);m=i;
}
~this(){
e=m;
printf("%i",e);
}
}
void f(){
B b=e;e=6;
}
void g(){
On Thursday, 23 March 2023 at 13:38:51 UTC, Alexander Zhirov
wrote:
Is it possible to convert such records inside the structure to
the assigned type?
```d
struct MyVal
{
string value;
// Here it would be possible to use an alias to this, but
it can only be used 1 time
}
auto a =
On Wednesday, 22 March 2023 at 15:23:42 UTC, Kagamin wrote:
https://dlang.org/phobos/std_stdio.html#rawWrite
It's really amazing, it succeeded. Thank you!
```cpp
auto b="test.txt";//gbk
void[]d=read(b);
stdout.rawWrite(d);
```
On Tuesday, 14 March 2023 at 09:20:54 UTC, Kagamin wrote:
I guess if your console is in gbk encoding, you can just write
bytes with stdout.write.
Thank you for your reply, but only display bytes, not gbk text.
On Monday, 13 March 2023 at 15:50:37 UTC, Steven Schveighoffer
wrote:
What is required is an addition to the `std.encoding` module,
to allow such an encoding.
Thank you for your information.
On Sunday, 12 March 2023 at 20:03:23 UTC, 0xEAB wrote:
...
Thank you for your reply, but is there any way to output `gbk`
code to the console?
On Saturday, 11 March 2023 at 19:56:09 UTC, 0xEAB wrote:
If you desire to use other encodings, how about using ubyte +
ubyte[]?
There is no example. An example should be added in an obvious
position.
I tried for a long time, but couldn't output `gbk`, and I finally
gave up.
On Friday, 10 March 2023 at 06:19:38 UTC, zjh wrote:
`D language` is too unfriendly for Chinese users!
You can't even write `gbk` files.
On Friday, 10 March 2023 at 02:48:43 UTC, John Xu wrote:
```d
module chinese;
import std.stdio : writeln;
import std.conv;
import std.windows.charset;
int main(string[] argv)
{
auto s1 = "中文";//utf8 字符串
writeln("word:"~ s1); //乱的
writeln("word:" ~
On Saturday, 18 February 2023 at 06:55:49 UTC, ProtectAndHide
wrote:
No, I think D is not for me.
They don't care about the needs of `D` users!
They won't listen ,even if you said it thousand times.
On Friday, 17 February 2023 at 01:21:18 UTC, zjh wrote:
They don't admit their mistakes! And `D` community is getting
smaller and smaller!
Because other languages laughs cry!
`D` don't even have `type-safe` classes.
The ability of a group of people to open their eyes and tell lies
is
On Friday, 17 February 2023 at 01:13:59 UTC, zjh wrote:
They can't refute you, so they have to blame you.
You can't wake up who pretend to sleep.
They don't admit their mistakes! And `D` community is getting
smaller and smaller!
If I were D author , I would suspect that they are undercover
On Thursday, 16 February 2023 at 22:25:22 UTC, ProtectAndHide
wrote:
also, I noticed that you intentionally? did not respond to the
facts that I outlined:
ie.
They can't refute you, so they have to blame you.
You can't wake up who pretend to sleep.
On Wednesday, 15 February 2023 at 12:44:19 UTC, zjh wrote:
Right... They greatly increase your code maintenance work!
Many people left D because of these small details!
Their encapsulation can actually leakage class members.
Programmers in other languages will laugh cry!
On Wednesday, 15 February 2023 at 09:57:56 UTC, ProtectAndHide
wrote:
In a module that contains a class, and other code as well
(perhaps other tightly coupled classes), you can know
**nothing** at all about that type (or any other class) without
knowing **everything** else in the module. If
On Wednesday, 15 February 2023 at 10:17:30 UTC, Mike Parker wrote:
I referenced that in my post. The exact same problem exists
*inside* the class when your class file is very long. You can
easily manipulate the private member even when it's only
supposed to be accessed by a specific function.
On Wednesday, 15 February 2023 at 08:57:27 UTC, Mike Parker wrote:
I meant to say, it "wouldn't add more".
What if two classes in the module that are several meters apart
make `mistakes` that change the privite variable of `another
class`?
No one can guarantee that after `a few months`,
On Friday, 10 February 2023 at 02:04:06 UTC, ProtectAndHide wrote:
"Before practicing Zen, mountains were mountains and rivers
were rivers.
While practicing Zen, mountains are no longer mountains and
rivers are no longer rivers.
After realization, mountains are mountains and rivers are
rivers
On Friday, 10 February 2023 at 00:58:51 UTC, zjh wrote:
I admit that you use 'D' happy, but you don't admit that I use
'D' unhappy.
Right,just `forkit`.
The `minority` language is more closed than the big language! If
you think about it, you will know that the `'D'` ranking should
fall!
On Thursday, 9 February 2023 at 20:05:06 UTC, Ali Çehreli wrote:
In contrast, I use D every day and love its relaxed attitude
towards private.
I admit that you use 'D' happy, but you don't admit that I use
'D' unhappy.
On Thursday, 9 February 2023 at 20:05:06 UTC, Ali Çehreli wrote:
On 2/8/23 04:07, zjh wrote:
Besides, D has zero problems with its private implementation in
the sense that there has been zero bugs related to it being
that way. In contrast, I use D every day and love its relaxed
attitude
On Thursday, 9 February 2023 at 14:03:41 UTC, zjh wrote:
If I can, I think `'D++'` is a good idea! Learn from a
`successful` language!
Don't be afraid of D becoming complex. C++ is already `super
complex`. Aren't there more and more people still using it?
Therefore, I don't approve of
On Thursday, 9 February 2023 at 13:49:03 UTC, zjh wrote:
..
There are too `few newcomers` to D, and D must change.
If I can, I think `'D++'` is a good idea! Learn from a
`successful` language!
The typical feature of `C++` is that you have it. Although I
don't have it now, I will have it
On Thursday, 9 February 2023 at 13:41:27 UTC, zjh wrote:
Our predecessors used D very early. At first, they were very
`excited`. But `later`, they left because some people in D were
too `stubborn`.
Therefore, the community is very small.
Our predecessors are `very smart` people, and they
On Thursday, 9 February 2023 at 13:32:36 UTC, zjh wrote:
They don't even admit the smaller the encapsulation, the better.
Our predecessors used D very early. At first, they were very
`excited`. But `later`, they left because some people in D were
too `stubborn`.
You can provide
On Thursday, 9 February 2023 at 13:07:56 UTC, thebluepandabear
wrote:
yeah the whole module behaviour with `private` is just a
massive turn off tbh, it needs to be changed to match the Java
style
They don't even admit the smaller the encapsulation, the better.
On Thursday, 9 February 2023 at 12:55:41 UTC, Guillaume Piolat
wrote:
yeah right let's implement everything that people propose
I like the concept of C++: I provide `facilities`, you can use it
or not.
Not that you can only do it `like this`! This is the only way.
What's more, people put
On Wednesday, 8 February 2023 at 12:12:57 UTC, thebluepandabear
wrote:
but I still think the language has potential in the future
I don't know if they have a sense of crisis. Now `D` in tiebo
ranks `50`.
On Wednesday, 8 February 2023 at 12:07:35 UTC, zjh wrote:
they are always unwilling to add facilities useful to others,
`D`'s community is small, this is the reason!
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear
wrote:
Hi,
In Java/C# you can create purely static classes.
...
Last time, someone proposed to add `private` like `C++'s`, and
then it was the same,they are always unwilling to add facilities
useful to others, and then he left
On Wednesday, 18 January 2023 at 02:05:34 UTC, zjh wrote:
< ...
`nightly`:
Unresolved external symbol `__va_start`, function `_fwprintf_`.
link error.
On Tuesday, 17 January 2023 at 11:16:25 UTC, DLearner wrote:
With the latest version of 'dmd101.2',`dmd a.c`, I get:
C:\Windows
Kits\10\Include\10.0.22000.0\ucrt\corecrt_wstdio.h|1208| Error:
function `a.__vswprintf_l` redeclaration with different type
C:\Windows
On Saturday, 31 December 2022 at 17:13:16 UTC, Hipreme wrote:
[...]
Nice article.
On Sunday, 11 December 2022 at 16:48:57 UTC, Ali Çehreli wrote:
However, the situation has changed in D: It has been possible
to pass rvalues by reference through the magic of 'in'
parameters. This currently requires the -preview=in compiler
switch, which makes 'in' parameters imply 'const
On Sunday, 11 December 2022 at 04:36:45 UTC, thebluepandabear
wrote:
"The main reason for this limitation is the fact that a
function taking a ref
parameter can hold on to that reference for later use, at a
time when the rvalue
would not be available."
I only know that `rvalue` is a
On Sunday, 11 December 2022 at 07:47:35 UTC, Salih Dincer wrote:
..
Thank you for your reply. I think if you take `random` values
frequently, you'd better use `'array'`,am I right?
On Saturday, 10 December 2022 at 19:49:23 UTC, Salih Dincer wrote:
SDB@79
Can the `range` be partially traversed? That is, suppose we only
access the `[3,5)` elements?
On Wednesday, 30 November 2022 at 01:17:14 UTC, zjh wrote:
Should there be an `intermediate layer` to simplify such
function calls?
There should be a `placeholder` similar to `inout` that can
absorb all `attributes` of the parameter.
On Wednesday, 30 November 2022 at 00:50:46 UTC, WebFreak001 wrote:
...
Should there be an `intermediate layer` to simplify such function
calls?
On Tuesday, 29 November 2022 at 01:08:03 UTC, zjh wrote:
...
```d
[Environment64]
LIB=%@P%\..\lib;%lj%\dku;
```
On Monday, 28 November 2022 at 16:21:20 UTC, NonNull wrote:
Any idea what may be going on with dmd?
use `sc.ini` like this:
```d
[Version]
version=7.51 Build 020
[Environment]
lj=E:\path
DFLAGS="-I%@P%\..\..\src\phobos"
"-I%@P%\..\..\src\druntime\import" "-I%lj%\dimport"
LIB="%@P%\..\lib"
On Thursday, 17 November 2022 at 04:25:13 UTC, Daniel Donnelly,
Jr. wrote:
...
`crtp`, will it work?
On Friday, 11 November 2022 at 13:05:19 UTC, Hipreme wrote:
...
Nice article,thank you.
On Tuesday, 8 November 2022 at 13:55:44 UTC, Adam D Ruppe wrote:
It is on my list but minigui is a pretty simple class
collection of basic widgets. It works pretty well now. I don't
have too many intro examples yet though. My blog has one thing
but it uses an experimental piece
On Monday, 7 November 2022 at 01:06:23 UTC, Adam D Ruppe wrote:
No, but not that much has changed and you can always post here
with questions.
How is your `minigui`? Please write an `introduction` when you
have time.
On Monday, 7 November 2022 at 04:54:05 UTC, ikelaiah wrote:
...
Yes, more than 100 skills, not easy get.
On Sunday, 6 November 2022 at 22:43:33 UTC, ikelaiah wrote:
Hi,
...
Is there a second edition? After all, it has been many years.
On Wednesday, 19 October 2022 at 05:41:26 UTC, zjh wrote:
Why always afraid to `add features`?
C++ is `so complicated` ,but that people are not afraid to
continue to `add features`.
Look at the `emerging` languages, which are not crazy about
`adding features`. Even `go` is adding generics.
On Wednesday, 19 October 2022 at 05:50:18 UTC, zjh wrote:
In my opinion, as long as `users` have reasonable needs,
languages should added corresponding features, instead of
becoming religions.
`Some features` are very popular for users,I really don't know
why they didn't add it.
When you
On Wednesday, 19 October 2022 at 05:41:26 UTC, zjh wrote:
Why can't do it `in one step`?
Why always afraid to `add features`?
C++ is `so complicated` ,but that people are not afraid to
continue to `add features`.
There is also `class level private`. I saw someone start it by
himself, and he
On Wednesday, 19 October 2022 at 04:59:40 UTC, mw wrote:
...
Why can't do it `in one step`?
Why always afraid to `add features`?
C++ is `so complicated` ,but that people are not afraid to
continue to `add features`.
On Thursday, 29 September 2022 at 20:56:50 UTC, Chris Piker wrote:
```lua
set_languages("c99")
```
Try:
`add_cxflags` or `add_files("src/*.c")` or
`set_languages("c")` or
`set_languages("c11")` .
or ,use `-l` to set language.
```cpp
xmake create -l c -t static test
```
On Wednesday, 28 September 2022 at 05:29:41 UTC, Chris Piker
wrote:
`Xmake` is indeed simpler.
`Xmake` is really nice!
On Saturday, 10 September 2022 at 22:07:32 UTC, Ali Çehreli wrote:
On 9/10/22 13:04, Daniel Donnell wrote:
> https://dlang.org/spec/cpp_interface.html
At DConf, Manu indicated that that page is outdated and that
D's C++ support is actually a lot better.
Update it quickly, This is a big
On Tuesday, 6 September 2022 at 19:44:23 UTC, jmh530 wrote:
.
`xmake` is simpler.
On Sunday, 4 September 2022 at 01:52:11 UTC, Ali Çehreli wrote:
Let's say I have three modules that work together, which I want
to register on dub: A, B, and C.
You should learn `ARSD`, and become `Ali-official`.
On Monday, 29 August 2022 at 21:46:48 UTC, ryuukk_ wrote:
What `-g` does that makes this code compile and work with DMD?
I guess it's global sharing. not `tls`.
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 Friday, 27 May 2022 at 13:40:25 UTC, Alexander Zhirov wrote:
I'm trying to compile a file that weighs 3 kilobytes. I'm also
linking a self-written dynamic library. I don't understand why
the resulting executable file is so huge?
I just switched from `32-bit` to 64 bit, but the '64' bit
On Friday, 20 May 2022 at 02:37:48 UTC, harakim wrote:
`winrt` may be good.
but `winrtd` has many bugs.
On Tuesday, 17 May 2022 at 11:50:30 UTC, zjh wrote:
Right,GC is a bad idea!
Endless use of memory without freeing.
It's totally unreasonable waste.
On Tuesday, 17 May 2022 at 06:28:10 UTC, cc wrote:
Far better to just keep your house clean every day than let the
trash pile up and wait for the maid to come, IMO.
Right,GC is a bad idea!
On Saturday, 14 May 2022 at 12:46:45 UTC, frame wrote:
Every
larger app with a news feed also has possibility to
categorize/filter it.
I think we can set up a special `web page` to collect `good
posts` and classify them according to `'author/category/label'`,
and its content can be
On Saturday, 14 May 2022 at 08:51:24 UTC, H. S. Teoh wrote:
The D wiki could be used for this purpose.
Many of your posts are very good. I like them very much. Thank
you.
I haven't played with `wiki`. However, Maybe we can `organize and
display` good posts according to
On Saturday, 14 May 2022 at 04:31:48 UTC, zjh wrote:
Likewise, each post could add something like `votes` ,
Or something like all kinds of `tags` such as
`range/fiber/commandline/auto ref/in/...`.
Making `good use` of the `existing answers` in the forum will be
very beneficial for `D`
On Saturday, 14 May 2022 at 04:09:00 UTC, Ali Çehreli wrote:
stopped by a spam filter.
Right.
D forum should add a "`author delete`" function.
Likewise, each post could add something like `votes` , good posts
will naturally `come out` and be collected together.
It's really convenient for
1 - 100 of 142 matches
Mail list logo