digitalmars.dip.ideas - The RangeExpression
- user1234 (5/5) Nov 12 Simple as
- user1234 (2/7) Nov 12 It's about https://wiki.dlang.org/DIP58 actually.
- ltdk (3/12) Nov 12 Oh, I really like it. Make tensor manipulation (pretty much
- Serg Gini (2/4) Nov 13 Do you use D for tensor manipulations?
- Quirin Schroll (2/11) Nov 20 Yes, please, this is overdue.
- user1234 (27/32) Nov 12 foreach over ranges is really special:
Simple as
Expression ".." Expression
Would simplify the grammar of the SwitchStatement, the
ForeachStatement. Would open possibilities for operator
overloading.
Nov 12
On Wednesday, 12 November 2025 at 18:34:01 UTC, user1234 wrote:
Simple as
Expression ".." Expression
Would simplify the grammar of the SwitchStatement, the
ForeachStatement. Would open possibilities for operator
overloading.
It's about https://wiki.dlang.org/DIP58 actually.
Nov 12
On Wednesday, 12 November 2025 at 18:38:06 UTC, user1234 wrote:On Wednesday, 12 November 2025 at 18:34:01 UTC, user1234 wrote:Oh, I really like it. Make tensor manipulation (pretty much anything related to ML/DL) more convenient.Simple as Expression ".." Expression Would simplify the grammar of the SwitchStatement, the ForeachStatement. Would open possibilities for operator overloading.It's about https://wiki.dlang.org/DIP58 actually.
Nov 12
On Thursday, 13 November 2025 at 03:11:36 UTC, ltdk wrote:Oh, I really like it. Make tensor manipulation (pretty much anything related to ML/DL) more convenient.Do you use D for tensor manipulations?
Nov 13
On Thursday, 13 November 2025 at 08:10:41 UTC, Serg Gini wrote:On Thursday, 13 November 2025 at 03:11:36 UTC, ltdk wrote:recently, no .... I switched to Julia.Oh, I really like it. Make tensor manipulation (pretty much anything related to ML/DL) more convenient.Do you use D for tensor manipulations?
Nov 14
On Thursday, 13 November 2025 at 08:10:41 UTC, Serg Gini wrote:On Thursday, 13 November 2025 at 03:11:36 UTC, ltdk wrote:Doesn't have to mean tensors per se. D's built-in arrays and mir's ndslice and any other similar projects would benefit from something like this.Oh, I really like it. Make tensor manipulation (pretty much anything related to ML/DL) more convenient.Do you use D for tensor manipulations?
Nov 14
On Wednesday, 12 November 2025 at 18:38:06 UTC, user1234 wrote:On Wednesday, 12 November 2025 at 18:34:01 UTC, user1234 wrote:Yes, please, this is overdue.Simple as Expression ".." Expression Would simplify the grammar of the SwitchStatement, the ForeachStatement. Would open possibilities for operator overloading.It's about https://wiki.dlang.org/DIP58 actually.
Nov 20
On Wednesday, 12 November 2025 at 18:34:01 UTC, user1234 wrote:
Simple as
Expression ".." Expression
Would simplify the grammar of the SwitchStatement, the
ForeachStatement. Would open possibilities for operator
overloading.
foreach over ranges is really special:
```d
int[] a;
foreach( i; mixin("a") ) {}
foreach( i; mixin("0 .. 100") ) {} // whoops
```
The problem however would be that the RangeExpression is an
internal compiler thing because it has no storage, example of
problematic uses:
```d
auto b = a .. c;
call(a .. z);
```
But you want them to be expressions anyway
```d
void v(alias T)(a)
{
switch (a){
case T: break;
default: assert(0);
}
}
v!(0..10)(rand());
```
So you're a bit between a macro and an expression. The D way for
macro is mixin, but here that does not work.
Nov 12









ltdk <khoa.alter.acc gmail.com> 