August 08, 2022
On Monday, 8 August 2022 at 00:11:33 UTC, pascal111 wrote:
> On Sunday, 7 August 2022 at 23:53:36 UTC, Emanuele Torre wrote:
>> On Sunday, 7 August 2022 at 16:01:08 UTC, pascal111 wrote:
>>> It's clear by working with D that it has the same bad point like Pascal language; the "verbosity". Is there any plans in future to make some shorthanded techniques that clean verbosity from D?
>>>
>>> Quote: "In terms of functionality, Pascal is pretty much exactly the same as C, except with some sanity-conserving restrictions on one hand, and more verbose syntax on the other. It was an okay language for the time when it was popular, and I would give it kudos just for having the common sense to make the assignment operator := instead of =, and not allowing it to be chained, but verbosity back then was still something to be avoided if possible, so C was naturally seen as superior."
>>>
>>> https://www.quora.com/Is-there-a-value-learning-Pascal-now-Are-there-actually-any-parts-where-Pascal-is-better-than-C-Is-this-language-worth-investing-time-into-What-would-the-added-value-be-if-I-learn-it
>>
>> Regaring this, I don't understand what you mean either.
>> How is D unnecesarily verbose?
>> Do you have any specific example?
>
> 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 D can do, while Python can't do.

You are just sounding like a troll now...

That makes no sense:

 "I assume that there are some special tasks D can do, while Python can't do"
 How?

 "Take Python as in example, the same program in Python doesn't cost much code as D code"
 What same program are you talking about? Why did you mention python as if you showed me an example I can see?

What am I supposed to say if can't even explain or show an example of how D is more verbose?

August 08, 2022

On Monday, 8 August 2022 at 00:15:48 UTC, pascal111 wrote:

>

On Sunday, 7 August 2022 at 23:44:26 UTC, Emanuele Torre wrote:

>

On Sunday, 7 August 2022 at 23:31:45 UTC, pascal111 wrote:

>

On Sunday, 7 August 2022 at 22:16:55 UTC, Emanuele Torre wrote:

>

[...]

It seems complex, I didn't get it yet, I wished I didn't ask about it :)

It's really trivial.
auto [x, y] = getpoint(); is equivalent to

auto _p = getpoint();
auto x = _p.x /* first element of the struct */;
auto y = _p.y /* second element of the struct */;`

Also works with arrays.

int[] arr = { 10, 12, 14 };
const auto [x, y, z] = arr;
/* x=10 y=12 z=14 */

A lot of programming languages have this.

Really, I'm not sure I'm understanding this syntax auto [x, y] = getpoint();, if you have the name of term of it in D or an explaining link.

D does not have it. You have already been told that when they have been mentioned.
If you want more information about it in C++, you could read https://en.cppreference.com/w/cpp/language/structured_binding or, for javascript, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment.

That was just meant to be a simple example to show what jfondren meant with "destructing bindings".

August 08, 2022
On Monday, 8 August 2022 at 00:18:12 UTC, Emanuele Torre wrote:
> On Monday, 8 August 2022 at 00:11:33 UTC, pascal111 wrote:
>> [...]
>
> You are just sounding like a troll now...
>
"troll" :) I like it!

> That makes no sense:
>
>  "I assume that there are some special tasks D can do, while Python can't do"
>  How?
>
>  "Take Python as in example, the same program in Python doesn't cost much code as D code"
>  What same program are you talking about? Why did you mention python as if you showed me an example I can see?
>
> What am I supposed to say if can't even explain or show an example of how D is more verbose?

Maybe I'm wrong, your words sound that Python isn't verbose-less.
August 08, 2022
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 D can do, while Python can't do.

There is definitely a spectrum of programming language practical expressiveness (the opposite of verbosity), with the dynamic languages (python, perl, ruby) on the "most expressive" end, and static languages (C, C++, Java) on the "most verbose" end.

D is somewhere in the middle of that spectrum, much more expressive than C but not as expressive as python.

The trade-off is much better run-time performance and lower memory overhead compared to the dynamic languages.

I've been writing C, Perl and Python for a living for a while, following the common practice of writing a solution in Perl or Python first, for shortest possible development time, and then rewriting performance-intensive bits in C when more performance is needed.

The appeal of D, to me, is that it gives me something akin to the same approach with just one language.  I can write very concise, expressive D when performance doesn't matter, and then write more verbose C-like D when I need C-like performance, all in the same source file, with the same language.

Having a sane and useful threading model is an added bonus.  Neither python nor perl nor nodejs have useful threads, whereas D gives us real, concurrent threads with a fraction of the boilerplate -- https://tour.dlang.org/tour/en/multithreading/synchronization-sharing

On the other hand, I've noticed that D's idiomatic brevity can be diluted by the extremely verbose function names used in the standard library.  Sure, foreach loops can be just as concise as python's -- foreach(i; arr) -- but then you end up getting carpal tunnel syndrome anyway from typing out  "AllImplicitConversionTargets" or "filterBidirectional" or "levenshteinDistanceAndPath".

My impression is that brevity is more important to the language developers than it is to the phobos developers.
August 08, 2022
On Monday, 8 August 2022 at 00:40:11 UTC, TTK Ciar wrote:
> On the other hand, I've noticed that D's idiomatic brevity can be diluted by the extremely verbose function names used in the standard library.

For long function names you can define short aliases, for syntax you can't. So having short and efficient language constructs is by far more important than short function names.
Especially a standard-library is much better off having descriptive and unique names - which sort of requires them to be long.
August 08, 2022

On Sunday, 7 August 2022 at 16:01:08 UTC, pascal111 wrote:

>

It's clear by working with D that it has the same bad point like Pascal language; the "verbosity". Is there any plans in future to make some shorthanded techniques that clean verbosity from D?

In most cases this is a false statement.
Just see examples on frontpage of dlang site.

Or try write and compare concrete programs.

Python have a good expressiveness, but up to 100 times slower.

August 08, 2022
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 D can do, while Python can't do.

Yeah I don't think this is true. The only clear difference between D and Python is the vast amount of libraries that Python has and that D is a static-typed language, Python is not (by default)

You generally don't write much more code.

Loops, ranges etc. are all just as pleasant to work with in D as they are in Python.

I'd argue it's even easier to work with classes in D than in Python, and even easier to work with metadata in D than any other language.

Python has an unnecessary amount of verbosity when it comes to OOP (because it really isn't an OOP language.)

I think D only looks verbose to people who don't really understand its metaprogramming capabilities, templates and/or are new to the language and perhaps come from dynamic typed languages.

But I don't think D is in particular more verbose than Python, you can write very similar expressions and some code are almost 1:1 in Python and D when you only consider syntax.
1 2
Next ›   Last »