On Monday, 22 September 2025 at 00:27:09 UTC, Steven
Schveighoffer wrote:
On Sunday, 21 September 2025 at 20:33:11 UTC, user1234 wrote:
On Saturday, 20 September 2025 at 02:36:47 UTC, Steven
Schveighoffer wrote:
Looking at historical compilers, the `alias ... =` syntax was
added in 2.087.0. B
On Sunday, 21 September 2025 at 20:33:11 UTC, user1234 wrote:
On Saturday, 20 September 2025 at 02:36:47 UTC, Steven
Schveighoffer wrote:
What is a function type? It's the internal type that the
compiler has for a function, which you actually cannot express
in syntax.
Actually D has a syntax
On Saturday, 20 September 2025 at 02:36:47 UTC, Steven
Schveighoffer wrote:
What is a function type? It's the internal type that the
compiler has for a function, which you actually cannot express
in syntax.
Actually D has a syntax to expression function types:
```d
alias FT = void(int);
void
On 9/18/25 10:18 PM, Steven Schveighoffer wrote:
> On Thursday, 18 September 2025 at 18:10:13 UTC, Ali Çehreli wrote:
>> // Not a delegate:
>> static assert(is (typeof(twice) == function));
> You are mistaking the is expression for a function test with the
> function pointer type.
I dis
On Friday, 19 September 2025 at 16:58:38 UTC, Ali Çehreli wrote:
On 9/18/25 10:18 PM, Steven Schveighoffer wrote:
> On Thursday, 18 September 2025 at 18:10:13 UTC, Ali Çehreli
wrote:
>> // Not a delegate:
>> static assert(is (typeof(twice) == function));
> You are mistaking the is expre
On Thursday, 18 September 2025 at 18:10:13 UTC, Ali Çehreli wrote:
As stated by multiple people, most nested functions will be
'delegates'. However, a nested function is a 'function' if it
does not touch local scope:
```d
void main() {
int twice(int i) {
return i * 2;
}
//
As stated by multiple people, most nested functions will be 'delegates'.
However, a nested function is a 'function' if it does not touch local scope:
void main() {
int twice(int i) {
return i * 2;
}
// Not a delegate:
static assert(is (typeof(twice) == function));
}
Ali
On Wednesday, 17 September 2025 at 22:16:50 UTC, Brother Bill
wrote:
In the following from Programming in D, page 483, we use
function keyword.
I expect that the first int in
```
int function(int);
```
represents the return value.
What does the second (int) refer to?
Second int is the type
On Wednesday, 17 September 2025 at 22:16:50 UTC, Brother Bill
wrote:
In the following from Programming in D, page 483, we use
function keyword.
I expect that the first int in
```
int function(int);
```
represents the return value.
What does the second (int) refer to?
Then there is another ex
On Wednesday, 17 September 2025 at 22:16:50 UTC, Brother Bill
wrote:
return value => increment + value; // ← compilation ERROR
```d
void main()
{
auto calc = makeCalculator;
writeln (calc (1));
}
alias Calculator = int function(int);
Calculator makeCalculator()
{
On Wednesday, 17 September 2025 at 22:16:50 UTC, Brother Bill
wrote:
Then there is another example with 'delegate' instead of
'function.
```
import std.stdio;
void main()
{
}
alias Calculator = int function(int);
Calculator makeCalculator()
{
int increment = 10;
return value
On Wed, Sep 17, 2025 at 10:16:50PM +, Brother Bill via Digitalmars-d-learn
wrote:
> In the following from Programming in D, page 483, we use function keyword.
>
> I expect that the first int in
> ```
> int function(int);
> ```
>
> represents the return value.
>
> What does the second (int)
On Wednesday, 17 September 2025 at 22:16:50 UTC, Brother Bill
wrote:
```
import std.stdio;
void main()
{
}
alias Calculator = int function(int);
Calculator makeCalculator()
{
int increment = 10;
return value => increment + value; // ← compilation ERROR
}
```
function is alm
13 matches
Mail list logo