static arrays becoming value types

grauzone none at example.net
Wed Oct 21 14:32:47 PDT 2009


Leandro Lucarella wrote:
> grauzone, el 21 de octubre a las 22:12 me escribiste:
>> Or even:
>>
>> a, b = foo();
>>
>> or
>>
>> a, _ = foo();
>>
>> Works in Python (tm)
> 
> _ is a regular symbol (variable name in this case), there is nothing
> special about the second form, which is exactly the same as the first. And


I didn't even know this. In Python, it doesn't matter anyway, because it 
is dynamically typed, and you can assign arbitrary values to the same 
variable.

Apparently, writing foreach (index,_;something) in D isn't a special 
case either; it just declares a variable named _. Several nested loops 
using _ are not possible.

PS: let's hope Walter recognizes the need of *good* syntax for a simple, 
basic language construct like tuples. Just look at language_fan's D code 
and compare it with the corresponding Python code posted afterward. The 
D code looks so ridiculous.

> BTW, the trailing ; is not needed ;)
> 



More information about the Digitalmars-d mailing list