May 01, 2022
On Sunday, 1 May 2022 at 08:14:34 UTC, Walter Bright wrote:

>
> Of interpreters that later generated native code. Not the other way around.

I don't quite understand why you insist on native code. Do compilers to bytecode count? There used to be a language called Nemerle (https://en.wikipedia.org/wiki/Nemerle), which had been mentioned on these forums many times, long before D got CTFE. The earliest mention I found is https://forum.dlang.org/post/ca56h1$2k4h$1@digitaldaemon.com. It had very powerful macros, which could be used as compile time functions, AST macros, and whatnot. The language is now dead because it was too good for humans.

>
>> However, I was responding to the other of your claims, which is - nobody asked for CTFE. I doubt it because the factorial implemented with templates is the first thing a new-born C++ programmer sees, and her first words are "Template metaprogramming is an abomination. Why can't we just evaluate functions at compile time?".
>
> You would think they would have, as many said it was an abomination. But they never said the next.
>
> There were many, many articles about using C++ templates as a Turing complete programming language. Find one that said "why can't we ..."
>
> Find one and I'll buy you a beer at DConf!

I think Nemerle deserves a case of beer.

May 01, 2022
On 5/1/22 00:12, Araq wrote:
> On Sunday, 1 May 2022 at 02:18:37 UTC, Ali Çehreli wrote:
>> > The tooling problems that result from
>> > `static if` are real.
>>
>> Oh! I must have missed their point.
>
> I cannot tell if you're sarcastic

I wasn't in a good mood yesterday. I apologize for that but I was only half sarcastic as most. :)

I think the authors desperately held on to one idea that they could prove to be correct. One truth does not make all their points correct.

> or not but the major point of
> contention is the scoping involved, `static if` doesn't introduce a new
> scope (and that's a feature) whereas C++'s `if constexpr` does introduce
> a scope. This really does make quite a difference for tooling.

C++ is not in a position to fake that it cares about tooling. That train has already landed... (What? :p)

Although tooling is a good point againts the proposal to discuss, it is nothing important to make anyone to write a paper to preemptively kill a proposal. After all, they could write (or say) that another token might be used. How about the angle brackets?

  static if (condition) <
    // ...
  >

Solved. :)

Ali

May 02, 2022
On Sunday, 1 May 2022 at 21:00:23 UTC, Ali Çehreli wrote:

> C++ is not in a position to fake that it cares about tooling. That train has already landed... (What? :p)
>

"X is already bad so let's make it worse."

> Although tooling is a good point againts the proposal to discuss, it is nothing important to make anyone to write a paper to preemptively kill a proposal. After all, they could write (or say) that another token might be used. How about the angle brackets?
>
>   static if (condition) <
>     // ...
>   >
>
> Solved. :)

The tooling problem is not caused by the syntax but by the scoping rules.
May 02, 2022

On Sunday, 1 May 2022 at 20:39:36 UTC, Max Samukha wrote:

>

On Sunday, 1 May 2022 at 08:14:34 UTC, Walter Bright wrote:

>

Of interpreters that later generated native code. Not the other way around.

I don't quite understand why you insist on native code. Do compilers to bytecode count? There used to be a language called Nemerle (https://en.wikipedia.org/wiki/Nemerle), which had been mentioned on these forums many times, long before D got CTFE. The earliest mention I found is https://forum.dlang.org/post/ca56h1$2k4h$1@digitaldaemon.com. It had very powerful macros, which could be used as compile time functions, AST macros, and whatnot. The language is now dead because it was too good for humans.
...

I think Nemerle deserves a case of beer.

Does writing a compile time function require any new knowledge/skill or is it like writing a runtime function? Accurately answering "they're like any other function, use functions in either context and you'll be fine" means you've got something immediately useful to newcomers, an ultra low friction path to more power.

Answering "no, but we have super duper xyz which is every bit as powerful theoretically and should probably be preferred because it's hard for people to understand and qualifies you for your programming wizard merit badge", means you, as a language designer, did not understand what you could have had.

Unless I'm missing something big from the Nemerle wiki page those language designers did not understand what they could have had.

I'm happy to give credit where it is due but I'd advise hanging on to that beer in this case. :-)

May 02, 2022

On Monday, 2 May 2022 at 00:21:10 UTC, Araq wrote:

>

On Sunday, 1 May 2022 at 21:00:23 UTC, Ali Çehreli wrote:

>

C++ is not in a position to fake that it cares about tooling. That train has already landed... (What? :p)

"X is already bad so let's make it worse."

>

Although tooling is a good point againts the proposal to discuss, it is nothing important to make anyone to write a paper to preemptively kill a proposal. After all, they could write (or say) that another token might be used. How about the angle brackets?

static if (condition) <
// ...

>

Solved. :)

The tooling problem is not caused by the syntax but by the scoping rules.

Yep. A lot of utility in scopeless but I'd imagine it's harder on the tooling folk (no guarantee of trivial mappings). Still, I think that upgrading the tooling is preferable to hobbling the language.

May 01, 2022
On 5/1/2022 1:39 PM, Max Samukha wrote:
> I don't quite understand why you insist on native code. Do compilers to bytecode count? There used to be a language called Nemerle (https://en.wikipedia.org/wiki/Nemerle), which had been mentioned on these forums many times, long before D got CTFE. The earliest mention I found is https://forum.dlang.org/post/ca56h1$2k4h$1@digitaldaemon.com. It had very powerful macros, which could be used as compile time functions, AST macros, and whatnot. The language is now dead because it was too good for humans.

Nemerle targeted C#'s bytecode system. I.e. it's an interpreter.

A language designed for interpretation does not distinguish between compile time and run time. While the program is executing, it can generate more code, which the interpreter executes. If the language is successful, it'll often get a native code generator to speed it up. The compiler is part of the runtime of the language.

A language designed for native compilation draws a hard distinction between compile time and run time. You'll see this in the grammar for the language, in the form of a constant-expression for compile time, and just expression for run time. The constant-expression does constant folding at compile time. The runtime does not include a compiler.

D is the first language I know of, designed for native compilation, with constant-expressions, that extended the evaluation of constant-expressions with the ability to execute functions at compile time. There's no compiler in the runtime. D does not support compiling code at runtime.

To clarify, if the runtime of a language includes a compiler, that is in the interpreted class of languages (even if they jit to native code), and it is not an example of what D's CTFE is doing. Lisp, Java, C# and apparently Nemerle fall into this category.

To show D is not the first, I request an example of a language designed for native compilation, that does not include a compiler in the runtime, that has constant-expressions in the grammar that must be computed at compile time and can execute ordinary functions at compile time.

C++ came closest to the mark with its Turing-complete templates.
May 02, 2022

On Sunday, 1 May 2022 at 16:56:12 UTC, Ola Fosheim Grøstad wrote:

>

On Sunday, 1 May 2022 at 16:31:20 UTC, claptrap wrote:

>

and real time as far as I remember. Im not even sure phase vocoders would have been feasible on dsp hardware in those days.

It was possible. The original papers on phase vocoders discuss real time.

I said it likely wasn't "feasible" not that it was impossible. Even the high end digital effects units in the mid 90s only managed a handful of basic effects at the same time, and they usually did that by using multiple chips, with different chips handling different blocks in the chain. A phase vocoder would have been pretty hard to pull off on that kind of hardware even if it was possible to a level of quality that was useful. I mean it's basically fft-->processing-->ifft, which is an order of magnitude or two more than the 20 or 30 cycles/sample you need to implement a reasonable quality chorus, phaser or eq, etc... Which is likely why AutoTune appeared first as a DAW plugin.

May 02, 2022
On Sunday, 1 May 2022 at 18:09:16 UTC, Walter Bright wrote:
> On 5/1/2022 9:31 AM, claptrap wrote:
>> And 99.9% of the time you're listening to AutoTuned vocals you dont even know.
>
> It's gotten to the point where I can tell :-)

How do you know when you cant tell? You dont, you just assume because you spot it sometimes you can always tell, you cant.

and the thing about singers being better in the 70s, it's not true, it's just that we've forgotten 90% of the music and we only remember the good stuff. It's natural selection. 20 or 30 years from now people will say the same about the 2010s, because all the crap will have been forgotten and only the good stuff remains. There's a name for it but I cant remember what it is.

I mean seriously look up the charts for a specific week in the 70s, or 80s or whatever, most of it was awful. But we just remember the stuff that stood the test of time.
May 01, 2022
On 5/1/22 17:21, Araq wrote:
> On Sunday, 1 May 2022 at 21:00:23 UTC, Ali Çehreli wrote:
>
>> C++ is not in a position to fake that it cares about tooling. That
>> train has already landed... (What? :p)
>>
>
> "X is already bad so let's make it worse."

Not at all. I meant, the authors could not use tooling problems as excuse because C++ was and is already hostile to tooling.

But I understand all your points so I am moving on to happier topics.

Ali

May 02, 2022
On Monday, 2 May 2022 at 02:24:01 UTC, Ali Çehreli wrote:
> On 5/1/22 17:21, Araq wrote:
...
> But I understand all your points so I am moving on to happier topics.

Very good idea.  I'm following your example.

>
> Ali