November 23, 2021

On Tuesday, 23 November 2021 at 10:15:52 UTC, Tejas wrote:

>

On Tuesday, 23 November 2021 at 07:55:45 UTC, Timon Gehr wrote:

>

On 12.10.21 23:38, Timon Gehr wrote:

> >
  • Features you'd like to see in D

Another thing I have sometimes wished for, but forgot to include:

  • package and module templates

You mean showing the static this() to accept parameters? That'd be amazing đŸ˜„

Not showing, I meant 'allowing'

November 23, 2021
On Tuesday, 16 November 2021 at 02:14:22 UTC, Timon Gehr wrote:
> On 15.11.21 09:01, Arjan wrote:
>> 
>>> [...]
>> 
>> Just WOW.
>> 
>> What would be needed to get you working on this again?
>
> Some reassurance that it won't be shot down for stupid reasons would go a long way. For `static foreach`, the desired semantics were clear to Walter and Andrei from the start and they really wanted that feature in DMD, so that the DIP process went pretty smoothly. I am not feeling any similar excitement for tuples, even though it's the most wanted feature among forum readers according to the state of D 2018 survey... I just don't have the time and energy required for week-long forum debates anymore.

I don't see any good reason to shut it down, never mind stupid reasons.
November 23, 2021
On 11/23/21 10:09 AM, bauss wrote:
> On Tuesday, 23 November 2021 at 07:55:45 UTC, Timon Gehr wrote:
>> On 12.10.21 23:38, Timon Gehr wrote:
>>>> * Features you'd like to see in D
>>
>> Another thing I have sometimes wished for, but forgot to include:
>>
>> - package and module templates
> 
> What do you mean by that?
> 
> Something like this? Or?
> 
> ```d
> module main;
> 
> import a!5;
> 
> void main()
> {
>      auto foo = new Foo;
>      foo.field4 = 10;
> }
> ```
> 
> ```d
> module a(int fieldCount);
> 
> import std.string : format;
> 
> class Foo
> {
>      static foreach (i; 0 .. fieldCount)
>      {
>          mixin(format("int field%d", i));
>      }
> }
> ```

Yes, something like this. Thanks for clarifying! This is a module template, I am not sure what's the best way to parameterize an entire package, maybe the declaration should be in every file like this:

module package_(T).a;
November 23, 2021
On Tuesday, 23 November 2021 at 09:09:03 UTC, bauss wrote:
> On Tuesday, 23 November 2021 at 07:55:45 UTC, Timon Gehr wrote:
>> On 12.10.21 23:38, Timon Gehr wrote:
>>>> * Features you'd like to see in D
>>
>> Another thing I have sometimes wished for, but forgot to include:
>>
>> - package and module templates
>
> What do you mean by that?
>
> Something like this? Or?
>
> ```d
> module main;
>
> import a!5;
>
> void main()
> {
> 	auto foo = new Foo;
> 	foo.field4 = 10;
> }
> ```
>
> ```d
> module a(int fieldCount);
>
> import std.string : format;
>
> class Foo
> {
> 	static foreach (i; 0 .. fieldCount)
> 	{
> 		mixin(format("int field%d", i));
> 	}
> }
> ```

I think that is what he means.
template modules are something I have thought about, it's a simple addition but I fear they might not be advisable in the long run. Unfortunately I cannot really put my finger onto why that might be.
I have a vague sense that this feature would lead to un-synchronized changes which are meant to be synchronized.

November 23, 2021

On Tuesday, 23 November 2021 at 14:09:56 UTC, Stefan Koch wrote:

>

template modules are something I have thought about, it's a simple addition but I fear they might not be advisable in the long run.

IIRC, Bjarne Stroustrup was advised to use the less problematic scheme of having parametric modules for C++, but he went with the more problematic templates instead. :-)

November 23, 2021

On Tuesday, 9 November 2021 at 11:37:49 UTC, Atila Neves wrote:

>

On Monday, 8 November 2021 at 14:23:15 UTC, Ola Fosheim Grøstad wrote:

>

On Monday, 8 November 2021 at 14:08:32 UTC, Atila Neves wrote:

>

I thought Rust error handling wasn't easy by default until they added the ? operator, at which point it became like exceptions but better.

Looks like syntactical sugar to me, but I am no Rust expert.

Correct, but then again, anything other than machine code is syntatical sugar. So is throw new Exception("oh noes");

>

It means you now loose context

I don't see how.

>

and how do you log?

The same way in pretty much any and all programs written that handles exceptions - some outer loop, possibly in the main function.

> >

To me that was always the issue with error handling without exceptions - how to easily just propagate it up (nearly always what one wants to do). I think they nailed it.

For simple situations maybe, but it looks like a hack, as far as I can tell from the docs.

I disagree. To me, it has all the convenience of exceptions with none of the drawbacks.

Actually, Rust also has exceptions but like Go, it's ashamed to admit it:

https://doc.rust-lang.org/std/panic/fn.catch_unwind.html

It's supposed to be used only for unrecoverable runtime errors (panics in Rust parlance).

November 24, 2021
On 23.11.21 14:41, Atila Neves wrote:
> On Tuesday, 16 November 2021 at 02:14:22 UTC, Timon Gehr wrote:
>> On 15.11.21 09:01, Arjan wrote:
>>>
>>>> [...]
>>>
>>> Just WOW.
>>>
>>> What would be needed to get you working on this again?
>>
>> Some reassurance that it won't be shot down for stupid reasons would go a long way. For `static foreach`, the desired semantics were clear to Walter and Andrei from the start and they really wanted that feature in DMD, so that the DIP process went pretty smoothly. I am not feeling any similar excitement for tuples, even though it's the most wanted feature among forum readers according to the state of D 2018 survey... I just don't have the time and energy required for week-long forum debates anymore.
> 
> I don't see any good reason to shut it down, never mind stupid reasons.

There are some details such as ABI and sizeof(()). I'll probably get back to this by January. (Some other commitments will have ended by then.)
November 24, 2021
>
  • Worst features implemented in a non-toy language
  • C: zero-terminated strings
  • Python 3: Metaclasses (they violate the philosophy of Python that code should be explicit, obvious and not "clever")
  • C++: where to start...
  • Java: the int/Integer (and similar) duality, made even worse by automatic boxing/unboxing
  • Still Java: Generic types erasure
>
  • Worst features (in your opinion) in D

I never really used D for anything beyond simple toy programs, but from reading about it it doesn't seem to have any truly egregious features as such apart from autodecoding. The main problem that I see is that everything is kind of half-baked, unfinished, features get added in a pursuit of the Great-Opportunity-of-the-week but they don't work coherently together.

November 24, 2021

On Wednesday, 24 November 2021 at 06:28:35 UTC, arco wrote:

The funniest part is that it's often not the deep users of D who say D is bad.

November 24, 2021

On Wednesday, 24 November 2021 at 06:48:12 UTC, zjh wrote:

>

On Wednesday, 24 November 2021 at 06:28:35 UTC, arco wrote:

The funniest part is that it's often not the deep users of D who say D is bad.

Well... Bubble, echo chamber, baby duck syndrome and all that.

When people are not heavy users of D, there may often have a reason. Many language communities actively listen to what the critics say and often try to acknowledge or even address the issues. If Dlang just wants to dismiss criticism as being irrelevant because it comes from someone who doesn't really use D, then all that will achieve is that 10 years from now there will still be threads "Why is D not popular?" ;)